1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/server/build/babel/preset.js
Arunoda Susiripala 9d529ea0b1 Remove babell-plugin-transform-react-constant-elements. (#1102)
* Remove babell-plugin-transform-react-constant-elements.
With this, our shared-modules example's counter won't work in
production mode. (as this plugin enabled)
So, we could see more issues like this.
That's why we don't need this at this time.

* Update package.json.
2017-02-14 07:37:34 +05:30

46 lines
1.4 KiB
JavaScript

const babelRuntimePath = require.resolve('babel-runtime/package')
.replace(/[\\/]package\.json$/, '')
const envPlugins = {
'development': [
require.resolve('babel-plugin-transform-react-jsx-source')
],
'production': [
require.resolve('babel-plugin-transform-react-remove-prop-types')
]
}
const plugins = envPlugins[process.env.NODE_ENV] || []
module.exports = {
presets: [
[require.resolve('babel-preset-latest'), {
'es2015': { modules: false }
}],
require.resolve('babel-preset-react')
],
plugins: [
require.resolve('babel-plugin-react-require'),
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'),
...plugins,
[
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'babel-runtime': babelRuntimePath,
'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'),
'next/error': require.resolve('../../../lib/error')
}
}
]
]
}