diff --git a/package.json b/package.json index 1a784df3157..99b90f59498 100644 --- a/package.json +++ b/package.json @@ -80,11 +80,23 @@ }, "babel": { "presets": [ - "es2015" + [ + "es2015", + { + "modules": false + } + ] ], "plugins": [ "transform-object-assign" - ] + ], + "env": { + "test": { + "presets": [ + "es2015" + ] + } + } }, "config": { "validate-commit-msg": { diff --git a/webpack.config.js b/webpack.config.js index 633ec0ae3f0..4796265992e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -41,6 +41,11 @@ const createBannerPlugin = () => new webpack.BannerPlugin({ entryOnly: true, }); +const LIFECYCLE_EVENT = process.env.npm_lifecycle_event; +if (LIFECYCLE_EVENT == 'test' || LIFECYCLE_EVENT == 'test:watch') { + process.env.BABEL_ENV = 'test'; +} + module.exports = [{ name: 'js-components', entry: { @@ -92,7 +97,6 @@ module.exports = [{ module: { rules: [{ test: /\.js$/, - include: [path.resolve(__dirname, 'packages/material-components-web')], exclude: /node_modules/, loader: 'babel-loader', options: {