Skip to content

Commit b8dc808

Browse files
committed
Do not pass node_modules to Babel
We used to pass Joi and its dependencies to Babel because they are distributing as ES6 libraries, not as ES5. While browsers are usually good enough to eat this, UglifyJS fails to process non ES5 blocks. Fortunately, we've upgraded to webpack 4 that comes with new version of uglifyjs-webpack-plugin that depends on uglify-es module rather than on uglify-js. The former supports non ES5 blocks so from now on any non ES5 code processed by uglifyjs-webpack-plugin will be transpiled to ES5.
1 parent e1c0f26 commit b8dc808

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

webpack.config.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,7 @@ module.exports = () => {
154154
// Transpile ES2015+ down to ES5.
155155
{
156156
test: /\.jsx?$/,
157-
include: [
158-
path.resolve(__dirname, 'src'),
159-
// Joi and its dependencies are not distributed as ES5 code, so
160-
// we need to transpile them as well; otherwise, UglifyJS will
161-
// fail to minify the sources.
162-
path.resolve(__dirname, 'node_modules', 'joi'),
163-
path.resolve(__dirname, 'node_modules', 'hoek'),
164-
path.resolve(__dirname, 'node_modules', 'topo'),
165-
path.resolve(__dirname, 'node_modules', 'isemail'),
166-
],
157+
include: path.resolve(__dirname, 'src'),
167158
use: ['babel-loader'],
168159
},
169160

0 commit comments

Comments
 (0)