Unverified Commit fb92fdef authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Make sure const/async is transpiled (#5760)

* Make sure const/async is transpiled

* Use babel common compilation instead
parent 4594b7cb
...@@ -273,9 +273,9 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer ...@@ -273,9 +273,9 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
}, },
{ {
test: /\.(js|jsx)$/, test: /\.(js|jsx)$/,
include: [dir, NEXT_PROJECT_ROOT_DIST_CLIENT, DEFAULT_PAGES_DIR], include: [dir, NEXT_PROJECT_ROOT_DIST_CLIENT, DEFAULT_PAGES_DIR, /next-server[\\/]dist[\\/]lib/],
exclude: (path) => { exclude: (path) => {
if (path.indexOf(NEXT_PROJECT_ROOT_DIST_CLIENT) === 0 || path.indexOf(DEFAULT_PAGES_DIR) === 0) { if (path.indexOf(NEXT_PROJECT_ROOT_DIST_CLIENT) === 0 || path.indexOf(DEFAULT_PAGES_DIR) === 0 || /next-server[\\/]dist[\\/]lib/.exec(path)) {
return false return false
} }
......
...@@ -2,6 +2,7 @@ import babelLoader from 'babel-loader' ...@@ -2,6 +2,7 @@ import babelLoader from 'babel-loader'
module.exports = babelLoader.custom(babel => { module.exports = babelLoader.custom(babel => {
const presetItem = babel.createConfigItem(require('../../babel/preset'), {type: 'preset'}) const presetItem = babel.createConfigItem(require('../../babel/preset'), {type: 'preset'})
const commonJsItem = babel.createConfigItem(require('@babel/plugin-transform-modules-commonjs'), {type: 'plugin'})
const configs = new Set() const configs = new Set()
...@@ -36,6 +37,16 @@ module.exports = babelLoader.custom(babel => { ...@@ -36,6 +37,16 @@ module.exports = babelLoader.custom(babel => {
options.presets = [...options.presets, presetItem] options.presets = [...options.presets, presetItem]
} }
options.overrides = [
...(options.overrides || []),
{
test: /next-server[\\/]dist[\\/]lib/,
plugins: [
commonJsItem
]
}
]
return options return options
} }
} }
......
...@@ -73,7 +73,7 @@ function throwIfNoRouter () { ...@@ -73,7 +73,7 @@ function throwIfNoRouter () {
export default SingletonRouter export default SingletonRouter
// Reexport the withRoute HOC // Reexport the withRoute HOC
export { default as withRouter } from '../lib/with-router' export { default as withRouter } from './with-router'
// INTERNAL APIS // INTERNAL APIS
// ------------- // -------------
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"@babel/plugin-proposal-class-properties": "7.1.0", "@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-object-rest-spread": "7.0.0", "@babel/plugin-proposal-object-rest-spread": "7.0.0",
"@babel/plugin-syntax-dynamic-import": "7.0.0", "@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-modules-commonjs": "7.1.0",
"@babel/plugin-transform-runtime": "7.1.0", "@babel/plugin-transform-runtime": "7.1.0",
"@babel/preset-env": "7.1.0", "@babel/preset-env": "7.1.0",
"@babel/preset-react": "7.0.0", "@babel/preset-react": "7.0.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment