diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 8c6b0197a8a88992a97a3dbe5ca97395a9823e00..0000000000000000000000000000000000000000 --- a/.babelrc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "presets": [ - "@babel/preset-env", - "@babel/preset-react" - ], - "plugins": [ - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-syntax-import-meta", - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-json-strings", - [ - "@babel/plugin-proposal-decorators", - { - "legacy": true - } - ], - "@babel/plugin-proposal-function-sent", - "@babel/plugin-proposal-export-namespace-from", - "@babel/plugin-proposal-numeric-separator", - "@babel/plugin-proposal-throw-expressions" - ] -} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000000000000000000000000000000000000..4dba60f1ad5d4cc35155b02504d07ddb7276a7d2 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,7 @@ +module.exports = { + presets: ['@babel/preset-env', '@babel/preset-react'], + plugins: [ + 'babel-plugin-styled-components', + '@babel/plugin-proposal-class-properties', + ], +} diff --git a/webpack/babel-includes.js b/webpack/babel-includes.js index c53c2f2413ab925c592dd8fdae22aaa74704b536..722366e5901319f8d3eb588466a452b4354b6f7e 100644 --- a/webpack/babel-includes.js +++ b/webpack/babel-includes.js @@ -7,9 +7,9 @@ module.exports = [ /pubsweet-[^/\\]+\/(?!node_modules)/, /@pubsweet\/[^/\\]+\/(?!node_modules)/, /xpub-[^/\\]+\/(?!node_modules)/, - /wax-[^/\\]+\/(?!node_modules)/, + // /wax-[^/\\]+\/(?!node_modules)/, // include other packages when this repo is mounted in a workspace - /components\/client\/[^/\\]+\/(?!node_modules)/, - /packages\/[^/\\]+\/(?!node_modules)/, + // /components\/client\/[^/\\]+\/(?!node_modules)/, + // /packages\/[^/\\]+\/(?!node_modules)/, /node_modules\/xpub-edit/, ] diff --git a/webpack/common-rules.js b/webpack/common-rules.js index 754d0bc55b59d292021c05d2a9ef8a14c3b7e5a6..0cc10ecc20e3477d290ea63467da526578b77f34 100644 --- a/webpack/common-rules.js +++ b/webpack/common-rules.js @@ -7,16 +7,8 @@ module.exports = [ test: /\.js$|\.jsx$/, loader: 'babel-loader', query: { - presets: [ - ['@babel/preset-env', { modules: false }], - '@babel/preset-react', - ], - plugins: [ - 'babel-plugin-styled-components', - require.resolve('react-hot-loader/babel'), - '@babel/plugin-proposal-class-properties', - // 'transform-decorators-legacy', - ], + presets: [['@babel/preset-env'], '@babel/preset-react'], + plugins: [require.resolve('react-hot-loader/babel')], env: { production: { /* bug requires mangle:false https://github.com/babel/minify/issues/556#issuecomment-339751209 */ @@ -39,39 +31,39 @@ module.exports = [ ], }, { test: /\.html$/, loader: 'html-loader' }, - { - test: /\.css$|\.scss$/, - exclude: /\.local\.s?css$/, // Exclude local styles from global - loader: [ - { - loader: 'style-loader', - }, - { - loader: 'css-loader', - }, - ], - }, - { - test: /\.css$|\.scss$/, - include: /\.local\.s?css/, // Local styles - loader: [ - { - loader: 'style-loader', - }, - { - loader: MiniCssExtractPlugin.loader, - options: { - hmr: process.env.NODE_ENV === 'development', - }, - }, - { - loader: 'css-loader', - options: { - modules: true, - importLoaders: 1, - localIdentName: '[name]_[local]-[hash:base64:8]', - }, - }, - ], - }, + // { + // test: /\.css$|\.scss$/, + // exclude: /\.local\.s?css$/, // Exclude local styles from global + // loader: [ + // { + // loader: 'style-loader', + // }, + // { + // loader: 'css-loader', + // }, + // ], + // }, + // { + // test: /\.css$|\.scss$/, + // include: /\.local\.s?css/, // Local styles + // loader: [ + // { + // loader: 'style-loader', + // }, + // { + // loader: MiniCssExtractPlugin.loader, + // options: { + // hmr: process.env.NODE_ENV === 'development', + // }, + // }, + // { + // loader: 'css-loader', + // options: { + // modules: true, + // importLoaders: 1, + // localIdentName: '[name]_[local]-[hash:base64:8]', + // }, + // }, + // ], + // }, ] diff --git a/webpack/plugins.js b/webpack/plugins.js index cdeca15bd456e4af29372778472ba610f5b98e8c..9eac16ed92425ec318a6aa263838c67c17bfa35c 100644 --- a/webpack/plugins.js +++ b/webpack/plugins.js @@ -63,7 +63,7 @@ module.exports = (opts = {}) => { new webpack.optimize.AggressiveMergingPlugin(), new webpack.optimize.OccurrenceOrderPlugin(), new CompressionPlugin(), - new BundleAnalyzerPlugin(), + // new BundleAnalyzerPlugin(), ) return plugins diff --git a/webpack/webpack.config.js b/webpack/webpack.config.js index 3e217964965394bc41e7b2cd27320d7f0da7d678..b7d020791347baf54c01a3604c24bcc0d10727f0 100644 --- a/webpack/webpack.config.js +++ b/webpack/webpack.config.js @@ -2,6 +2,10 @@ const path = require('path') const fs = require('fs-extra') const config = require('config') const { pick } = require('lodash') + +const SpeedMeasurePlugin = require('speed-measure-webpack-plugin') +const smp = new SpeedMeasurePlugin() + const rules = require('./common-rules') const contentBase = path.resolve(__dirname, '..', '_build', 'assets')