mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add react-jsx-source for development (#1115)
This commit is contained in:
parent
b0d1e7e3d1
commit
77c14f96b1
|
@ -53,6 +53,7 @@
|
||||||
"babel-plugin-transform-es2015-modules-commonjs": "6.22.0",
|
"babel-plugin-transform-es2015-modules-commonjs": "6.22.0",
|
||||||
"babel-plugin-transform-object-rest-spread": "6.22.0",
|
"babel-plugin-transform-object-rest-spread": "6.22.0",
|
||||||
"babel-plugin-transform-react-constant-elements": "^6.22.0",
|
"babel-plugin-transform-react-constant-elements": "^6.22.0",
|
||||||
|
"babel-plugin-transform-react-jsx-source": "^6.22.0",
|
||||||
"babel-plugin-transform-react-remove-prop-types": "^0.3.2",
|
"babel-plugin-transform-react-remove-prop-types": "^0.3.2",
|
||||||
"babel-plugin-transform-runtime": "6.22.0",
|
"babel-plugin-transform-runtime": "6.22.0",
|
||||||
"babel-preset-latest": "6.22.0",
|
"babel-preset-latest": "6.22.0",
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
const isProduction = process.env.NODE_ENV === 'production'
|
|
||||||
const babelRuntimePath = require.resolve('babel-runtime/package')
|
const babelRuntimePath = require.resolve('babel-runtime/package')
|
||||||
.replace(/[\\/]package\.json$/, '')
|
.replace(/[\\/]package\.json$/, '')
|
||||||
|
|
||||||
const productionPlugins = isProduction ? [
|
const envPlugins = {
|
||||||
require.resolve('babel-plugin-transform-react-constant-elements'),
|
'development': [
|
||||||
require.resolve('babel-plugin-transform-react-remove-prop-types')
|
require.resolve('babel-plugin-transform-react-jsx-source')
|
||||||
] : []
|
],
|
||||||
|
'production': [
|
||||||
|
require.resolve('babel-plugin-transform-react-constant-elements'),
|
||||||
|
require.resolve('babel-plugin-transform-react-remove-prop-types')
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const plugins = envPlugins[process.env.NODE_ENV] || []
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
|
@ -20,7 +26,7 @@ module.exports = {
|
||||||
require.resolve('babel-plugin-transform-class-properties'),
|
require.resolve('babel-plugin-transform-class-properties'),
|
||||||
require.resolve('babel-plugin-transform-runtime'),
|
require.resolve('babel-plugin-transform-runtime'),
|
||||||
require.resolve('styled-jsx/babel'),
|
require.resolve('styled-jsx/babel'),
|
||||||
...productionPlugins,
|
...plugins,
|
||||||
[
|
[
|
||||||
require.resolve('babel-plugin-module-resolver'),
|
require.resolve('babel-plugin-module-resolver'),
|
||||||
{
|
{
|
||||||
|
|
|
@ -729,7 +729,7 @@ babel-plugin-transform-react-jsx-self@^6.22.0:
|
||||||
babel-plugin-syntax-jsx "^6.8.0"
|
babel-plugin-syntax-jsx "^6.8.0"
|
||||||
babel-runtime "^6.22.0"
|
babel-runtime "^6.22.0"
|
||||||
|
|
||||||
babel-plugin-transform-react-jsx-source@^6.22.0:
|
babel-plugin-transform-react-jsx-source, babel-plugin-transform-react-jsx-source@^6.22.0:
|
||||||
version "6.22.0"
|
version "6.22.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6"
|
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue