mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
f3e541fe23
* Let webpack2 to handle ES2015 module system Since Node.js can't do that, we need to transpile ES2015 module system in the emit-file-loader. * Use sourceMaps only in dev. * Introduce a transform option to emit-file-loader So, we can move our ES2015 transpile code with that option. * Remove unwanted argument options. * Update comments. * Use dev flag instead of NODE_ENV
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
const babelRuntimePath = require.resolve('babel-runtime/package')
|
|
.replace(/[\\/]package\.json$/, '')
|
|
|
|
module.exports = {
|
|
presets: [
|
|
[require.resolve('babel-preset-es2015'), { modules: false }],
|
|
require.resolve('babel-preset-react')
|
|
],
|
|
plugins: [
|
|
require.resolve('babel-plugin-react-require'),
|
|
require.resolve('babel-plugin-transform-async-to-generator'),
|
|
require.resolve('babel-plugin-transform-object-rest-spread'),
|
|
require.resolve('babel-plugin-transform-class-properties'),
|
|
require.resolve('babel-plugin-transform-runtime'),
|
|
require.resolve('styled-jsx/babel'),
|
|
[
|
|
require.resolve('babel-plugin-module-resolver'),
|
|
{
|
|
alias: {
|
|
'babel-runtime': babelRuntimePath,
|
|
react: require.resolve('react'),
|
|
'react-dom': require.resolve('react-dom'),
|
|
'react-dom/server': require.resolve('react-dom/server'),
|
|
'next/link': require.resolve('../../../lib/link'),
|
|
'next/prefetch': require.resolve('../../../lib/prefetch'),
|
|
'next/css': require.resolve('../../../lib/css'),
|
|
'next/head': require.resolve('../../../lib/head'),
|
|
'next/document': require.resolve('../../../server/document'),
|
|
'next/router': require.resolve('../../../lib/router'),
|
|
'styled-jsx/style': require.resolve('styled-jsx/style')
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|