Move frontend babel configuration to webpack configuration file.
parent
ac951aba32
commit
fc0b06a1be
10
.babelrc
10
.babelrc
|
@ -2,20 +2,14 @@
|
||||||
"presets": [
|
"presets": [
|
||||||
["babel-preset-env", {
|
["babel-preset-env", {
|
||||||
"targets": {
|
"targets": {
|
||||||
"browsers": [
|
"node": true,
|
||||||
"> 1%",
|
|
||||||
"last 4 versions",
|
|
||||||
"Firefox ESR",
|
|
||||||
"ios >= 8"
|
|
||||||
],
|
|
||||||
"uglify": false
|
"uglify": false
|
||||||
},
|
},
|
||||||
"spec": true,
|
"spec": true,
|
||||||
"debug": true
|
"debug": false
|
||||||
}]
|
}]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"babel-plugin-transform-react-constant-elements",
|
|
||||||
"babel-plugin-transform-class-properties",
|
"babel-plugin-transform-class-properties",
|
||||||
"babel-plugin-syntax-dynamic-import"
|
"babel-plugin-syntax-dynamic-import"
|
||||||
]
|
]
|
||||||
|
|
32
src/.babelrc
32
src/.babelrc
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
["babel-preset-env", {
|
|
||||||
"targets": {
|
|
||||||
"browsers": [
|
|
||||||
"> 1%",
|
|
||||||
"last 4 versions",
|
|
||||||
"Firefox ESR",
|
|
||||||
"ios >= 8"
|
|
||||||
],
|
|
||||||
"uglify": false
|
|
||||||
},
|
|
||||||
/*"spec": true,*/
|
|
||||||
"debug": true,
|
|
||||||
"modules": false
|
|
||||||
}],
|
|
||||||
"babel-preset-react"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"react-hot-loader/babel",
|
|
||||||
"babel-plugin-transform-react-constant-elements",
|
|
||||||
/*"babel-plugin-transform-react-remove-prop-types",*/
|
|
||||||
/*"babel-plugin-transform-decorators-legacy",*/
|
|
||||||
"babel-plugin-transform-class-properties",
|
|
||||||
["babel-plugin-transform-runtime", {
|
|
||||||
"helpers": false,
|
|
||||||
"polyfill": false,
|
|
||||||
"regenerator": true
|
|
||||||
}],
|
|
||||||
"babel-plugin-syntax-dynamic-import"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -28,6 +28,13 @@ const {
|
||||||
|
|
||||||
const locales = ['en'];
|
const locales = ['en'];
|
||||||
|
|
||||||
|
const autoprefixerTargets = [
|
||||||
|
'> 1%',
|
||||||
|
'last 4 versions',
|
||||||
|
'Firefox ESR',
|
||||||
|
'ios >= 8',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin for HtmlPlugin which inlines content for an extracted Webpack manifest
|
* Plugin for HtmlPlugin which inlines content for an extracted Webpack manifest
|
||||||
* into the HTML in a <script> tag before other emitted asssets are injected by
|
* into the HTML in a <script> tag before other emitted asssets are injected by
|
||||||
|
@ -153,7 +160,7 @@ export default (options) => {
|
||||||
ident: 'postcss',
|
ident: 'postcss',
|
||||||
plugins: [
|
plugins: [
|
||||||
autoprefixer({
|
autoprefixer({
|
||||||
browsers: '> 1%, last 4 versions, Firefox ESR, ios >= 8',
|
browsers: autoprefixerTargets,
|
||||||
grid: false,
|
grid: false,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -190,7 +197,7 @@ export default (options) => {
|
||||||
return cssLoaders;
|
return cssLoaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const config = {
|
||||||
devServer: {
|
devServer: {
|
||||||
// inline: true,
|
// inline: true,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -214,11 +221,34 @@ export default (options) => {
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
options: {
|
options: {
|
||||||
// Look for babel configuration in project directory
|
// Look for babel configuration in project directory
|
||||||
babelrc: true,
|
babelrc: false,
|
||||||
// Cache transformations to the filesystem (in default temp dir)
|
// Cache transformations to the filesystem (in default temp dir)
|
||||||
cacheDirectory: true,
|
cacheDirectory: true,
|
||||||
// Skip module transpiling as Webpack 2+ support it ootb
|
|
||||||
forceEnv: 'browser',
|
forceEnv: 'browser',
|
||||||
|
|
||||||
|
presets: [
|
||||||
|
['babel-preset-env', {
|
||||||
|
targets: {
|
||||||
|
browsers: autoprefixerTargets,
|
||||||
|
uglify: false,
|
||||||
|
},
|
||||||
|
// spec: true,
|
||||||
|
debug: development,
|
||||||
|
modules: false, // do not transpile modules, webpack 2+ does that
|
||||||
|
}],
|
||||||
|
'babel-preset-react',
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'babel-plugin-transform-react-constant-elements',
|
||||||
|
'babel-plugin-transform-class-properties',
|
||||||
|
['babel-plugin-transform-runtime', {
|
||||||
|
helpers: false,
|
||||||
|
polyfill: false,
|
||||||
|
regenerator: true,
|
||||||
|
}],
|
||||||
|
'babel-plugin-syntax-dynamic-import',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...[
|
...[
|
||||||
|
|
Loading…
Reference in New Issue