Skip to content

Commit

Permalink
ARROW-12702: [JS] Update webpack and terser
Browse files Browse the repository at this point in the history
Closes apache#10275 from domoritz/webpack

Authored-by: Dominik Moritz <domoritz@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
domoritz authored and michalursa committed Jun 13, 2021
1 parent 5a2693c commit 300e985
Show file tree
Hide file tree
Showing 3 changed files with 413 additions and 1,198 deletions.
10 changes: 4 additions & 6 deletions js/gulp/minify-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const minifyTask = ((cache, commonConfig) => memoizeTask(cache, function minifyJ

const webpackConfigs = [mainExport].map((entry) => ({
...targetConfig,
mode: 'production',
name: entry,
entry: { [entry]: path.resolve(`${src}/${entry}.dom.js`) },
plugins: [
Expand All @@ -62,13 +63,10 @@ const minifyTask = ((cache, commonConfig) => memoizeTask(cache, function minifyJ
minimize: true,
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
ecma: terserLanguageNames[target],
output: { comments: false, beautify: false },
compress: { unsafe: true },
mangle: true,
safari10: true // <-- works around safari10 bugs, see the "safari10" option here: https://github.com/terser-js/terser#minify-options
output: { comments: false },
compress: { unsafe: true }
},
})
]
Expand All @@ -83,7 +81,7 @@ const minifyTask = ((cache, commonConfig) => memoizeTask(cache, function minifyJ
}))({}, {
resolve: { mainFields: [`module`, `main`] },
module: { rules: [{ test: /\.js$/, enforce: `pre`, use: [`source-map-loader`] }] },
output: { filename: '[name].js', library: mainExport, libraryTarget: `umd`, umdNamedDefine: true },
output: { filename: '[name].js', library: mainExport, libraryTarget: `umd`, umdNamedDefine: true, globalObject: 'this' },
});

module.exports = minifyTask;
Expand Down
21 changes: 10 additions & 11 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
],
"dependencies": {
"@types/flatbuffers": "^1.10.0",
"@types/node": "^14.14.37",
"@types/node": "^15.0.2",
"@types/text-encoding-utf-8": "^1.0.1",
"command-line-args": "5.1.1",
"command-line-usage": "6.1.1",
Expand All @@ -65,10 +65,10 @@
"tslib": "^2.2.0"
},
"devDependencies": {
"@types/glob": "7.1.1",
"@types/jest": "26.0.22",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@types/glob": "7.1.3",
"@types/jest": "26.0.23",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"async-done": "1.3.1",
"benny": "3.6.15",
"cpy": "^8.1.2",
Expand All @@ -80,9 +80,9 @@
"glob": "7.1.4",
"google-closure-compiler": "20210406.0.0",
"gulp": "4.0.2",
"gulp-json-transform": "0.4.6",
"gulp-rename": "1.4.0",
"gulp-sourcemaps": "2.6.5",
"gulp-json-transform": "0.4.7",
"gulp-rename": "2.0.0",
"gulp-sourcemaps": "3.0.0",
"gulp-typescript": "5.0.1",
"ix": "2.5.3",
"jest": "26.6.3",
Expand All @@ -94,15 +94,14 @@
"npm-run-all": "4.1.5",
"randomatic": "3.1.1",
"rxjs": "5.5.11",
"source-map-loader": "0.2.4",
"terser-webpack-plugin": "4.2.2",
"source-map-loader": "2.0.1",
"ts-jest": "26.5.4",
"ts-node": "9.1.1",
"typedoc": "0.20.35",
"typescript": "4.0.2",
"web-stream-tools": "0.0.1",
"web-streams-polyfill": "3.0.3",
"webpack": "4.29.0",
"webpack": "5.36.2",
"xml2js": "0.4.19"
},
"engines": {
Expand Down
Loading

0 comments on commit 300e985

Please sign in to comment.