mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Make sure const/async is transpiled (#5760)
* Make sure const/async is transpiled * Use babel common compilation instead
This commit is contained in:
parent
4594b7cb07
commit
fb92fdef54
|
@ -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'
|
||||||
|
|
||||||
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 => {
|
||||||
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 () {
|
||||||
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 @@
|
||||||
"@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",
|
||||||
|
|
Loading…
Reference in a new issue