Commit 85d4a3a5 authored by Tasso Evangelista's avatar Tasso Evangelista Committed by Guilherme Gazzo
Browse files

fix: Set a conservative output.environment on Webpack bundles (#330)

parent 84e0a8a2
...@@ -12,11 +12,20 @@ module.exports = (env, { mode = 'production' }) => ({ ...@@ -12,11 +12,20 @@ module.exports = (env, { mode = 'production' }) => ({
'fuselage-ui-kit': path.resolve(__dirname, 'src/index.js'), 'fuselage-ui-kit': path.resolve(__dirname, 'src/index.js'),
}, },
output: { output: {
filename: `[name].${ mode }.js`, filename: `[name].${mode}.js`,
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
library: 'RocketChatFuselageUiKit', library: 'RocketChatFuselageUiKit',
libraryTarget: 'umd', libraryTarget: 'umd',
umdNamedDefine: true, umdNamedDefine: true,
environment: {
arrowFunction: false,
bigIntLiteral: false,
const: false,
destructuring: false,
dynamicImport: false,
forOf: false,
module: false,
},
}, },
devtool: mode === 'production' ? false : 'source-map', devtool: mode === 'production' ? false : 'source-map',
module: { module: {
...@@ -28,11 +37,7 @@ module.exports = (env, { mode = 'production' }) => ({ ...@@ -28,11 +37,7 @@ module.exports = (env, { mode = 'production' }) => ({
}, },
], ],
}, },
externals: [ externals: ['react', 'react-dom', /^@rocket.chat\//],
'react',
'react-dom',
/^@rocket.chat\//,
],
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(pkg.version), 'process.env.VERSION': JSON.stringify(pkg.version),
......
...@@ -9,11 +9,20 @@ module.exports = (env, { mode = 'production' }) => ({ ...@@ -9,11 +9,20 @@ module.exports = (env, { mode = 'production' }) => ({
fuselage: path.resolve(__dirname, 'src/index.js'), fuselage: path.resolve(__dirname, 'src/index.js'),
}, },
output: { output: {
filename: `[name].${ mode }.js`, filename: `[name].${mode}.js`,
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
library: 'RocketChatFuselage', library: 'RocketChatFuselage',
libraryTarget: 'umd', libraryTarget: 'umd',
umdNamedDefine: true, umdNamedDefine: true,
environment: {
arrowFunction: false,
bigIntLiteral: false,
const: false,
destructuring: false,
dynamicImport: false,
forOf: false,
module: false,
},
}, },
devtool: mode === 'production' ? false : 'source-map', devtool: mode === 'production' ? false : 'source-map',
module: { module: {
......
/node_modules /node_modules
/dist /dist
!/.eslintrc.js !/.eslintrc.js
/webpack.config.js
...@@ -16,6 +16,15 @@ module.exports = (env, argv) => ({ ...@@ -16,6 +16,15 @@ module.exports = (env, argv) => ({
library: 'RocketChatUiKit', library: 'RocketChatUiKit',
libraryTarget: 'umd', libraryTarget: 'umd',
umdNamedDefine: true, umdNamedDefine: true,
environment: {
arrowFunction: false,
bigIntLiteral: false,
const: false,
destructuring: false,
dynamicImport: false,
forOf: false,
module: false,
},
}, },
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js'], extensions: ['.ts', '.tsx', '.js'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment