Skip to content

Commit

Permalink
Enables tree shaking
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Apr 3, 2020
1 parent cf81ef6 commit 8ff2de0
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
"xmlbuilder": "13.0.2",
"zlib": "^1.0.5"
},
"sideEffects": false,
"engines": {
"node": "10.19.0",
"yarn": "^1.21.1"
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.1",
"@babel/preset-typescript": "^7.9.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ module.exports = () => {
require('./common_preset'),
],
plugins: [
require.resolve('@babel/plugin-transform-modules-commonjs'),
require.resolve('@babel/plugin-syntax-dynamic-import'),
[
require.resolve('babel-plugin-styled-components'),
{
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-i18n/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
env: {
web: {
presets: ['@kbn/babel-preset/webpack_preset'],
plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
},
node: {
presets: ['@kbn/babel-preset/node_preset'],
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"presets": ["@kbn/babel-preset/node_preset"],
"plugins": [
["@babel/plugin-transform-runtime", {
"regenerator": true
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
},

optimization: {
usedExports: true,
noEmitOnErrors: true,
},

Expand Down Expand Up @@ -258,14 +259,14 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
],

optimization: {
usedExports: true,
minimizer: [
new TerserPlugin({
cache: false,
sourceMap: false,
extractComments: false,
parallel: false,
terserOptions: {
compress: false,
mangle: false,
},
}),
Expand Down
4 changes: 2 additions & 2 deletions src/optimize/create_ui_exports_module.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function normalizePath(path) {
return path.replace(/[\\\/]+/g, '/');
}

export default function() {
module.exports = function() {
if (!module.id.includes('?')) {
throw new Error('create_ui_exports_module loaded without JSON args in module.id');
}
Expand All @@ -37,4 +37,4 @@ export default function() {
return {
code: `${comment}\n${requires}\n`,
};
}
};
2 changes: 1 addition & 1 deletion tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es5",
"target": "esnext",
"module": "esnext",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"test:jest": "node scripts/jest",
"test:mocha": "node scripts/mocha"
},
"sideEffects": false,
"kibana": {
"build": {
"intermediateBuildDirectory": "build/plugin/kibana/x-pack",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"

"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.8.0", "@babel/plugin-syntax-dynamic-import@^7.8.3":
"@babel/plugin-syntax-dynamic-import@^7.2.0", "@babel/plugin-syntax-dynamic-import@^7.8.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3"
integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==
Expand Down

0 comments on commit 8ff2de0

Please sign in to comment.