Skip to content

Commit

Permalink
Fixes LIT_TYPES_REGISTRY in OSS builds by preserving TS/JS class names
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 470740806
  • Loading branch information
RyanMullins authored and LIT team committed Aug 29, 2022
1 parent 10e2548 commit 948adb3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lit_nlp/client/webpack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const glob = require('glob');
const path = require('path');
const webpack = require('webpack');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");

const GLOB_OPTIONS = {
ignore: ['**/*test.ts', '**/*test.js', '**/testing_utils.ts']
Expand Down Expand Up @@ -109,7 +110,7 @@ module.exports = (env = {}) => {
}

return {
mode: 'development',
mode: isProd ? 'production' : 'development',
devtool: 'source-map',
module: {
rules: [
Expand All @@ -135,6 +136,19 @@ module.exports = (env = {}) => {
},
],
},
optimization: {
minimize: isProd,
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
terserOptions: {
keep_classnames: true // Required for LIT_TYPES_REGISTRY to work
}
})
]
},
resolve: {
modules: ['node_modules'],
extensions: ['.ts', '.js'],
Expand Down

0 comments on commit 948adb3

Please sign in to comment.