Fix compilation errors on production
This commit is contained in:
parent
dc470c1d2c
commit
c40814e1b1
2 changed files with 35 additions and 35 deletions
|
@ -1,18 +1,20 @@
|
||||||
module.exports = function(api) {
|
/* eslint-disable global-require */
|
||||||
var validEnv = ['development', 'test', 'production']
|
|
||||||
var currentEnv = api.env()
|
module.exports = api => {
|
||||||
var isDevelopmentEnv = api.env('development')
|
const validEnv = ['development', 'test', 'production'];
|
||||||
var isProductionEnv = api.env('production')
|
const currentEnv = api.env();
|
||||||
var isTestEnv = api.env('test')
|
const isDevelopmentEnv = api.env('development');
|
||||||
|
const isProductionEnv = api.env('production');
|
||||||
|
const isTestEnv = api.env('test');
|
||||||
|
|
||||||
if (!validEnv.includes(currentEnv)) {
|
if (!validEnv.includes(currentEnv)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Please specify a valid `NODE_ENV` or ' +
|
`${'Please specify a valid `NODE_ENV` or ' +
|
||||||
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
||||||
'"test", and "production". Instead, received: ' +
|
'"test", and "production". Instead, received: '}${JSON.stringify(
|
||||||
JSON.stringify(currentEnv) +
|
currentEnv
|
||||||
'.'
|
)}.`
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -21,9 +23,9 @@ module.exports = function(api) {
|
||||||
require('@babel/preset-env').default,
|
require('@babel/preset-env').default,
|
||||||
{
|
{
|
||||||
targets: {
|
targets: {
|
||||||
node: 'current'
|
node: 'current',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
(isProductionEnv || isDevelopmentEnv) && [
|
(isProductionEnv || isDevelopmentEnv) && [
|
||||||
require('@babel/preset-env').default,
|
require('@babel/preset-env').default,
|
||||||
|
@ -32,9 +34,9 @@ module.exports = function(api) {
|
||||||
useBuiltIns: 'entry',
|
useBuiltIns: 'entry',
|
||||||
corejs: 3,
|
corejs: 3,
|
||||||
modules: false,
|
modules: false,
|
||||||
exclude: ['transform-typeof-symbol']
|
exclude: ['transform-typeof-symbol'],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
plugins: [
|
plugins: [
|
||||||
require('babel-plugin-macros'),
|
require('babel-plugin-macros'),
|
||||||
|
@ -44,32 +46,30 @@ module.exports = function(api) {
|
||||||
[
|
[
|
||||||
require('@babel/plugin-proposal-class-properties').default,
|
require('@babel/plugin-proposal-class-properties').default,
|
||||||
{
|
{
|
||||||
loose: true
|
loose: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
require('@babel/plugin-proposal-object-rest-spread').default,
|
require('@babel/plugin-proposal-object-rest-spread').default,
|
||||||
{
|
{
|
||||||
useBuiltIns: true
|
useBuiltIns: true,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
require('@babel/plugin-transform-runtime').default,
|
require('@babel/plugin-transform-runtime').default,
|
||||||
{
|
{
|
||||||
helpers: false,
|
helpers: false,
|
||||||
regenerator: true,
|
regenerator: true,
|
||||||
corejs: false
|
corejs: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
require('@babel/plugin-transform-regenerator').default,
|
require('@babel/plugin-transform-regenerator').default,
|
||||||
{
|
{
|
||||||
async: false
|
async: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
[
|
[require('babel-plugin-transform-vue-jsx')],
|
||||||
require('babel-plugin-transform-vue-jsx')
|
].filter(Boolean),
|
||||||
]
|
};
|
||||||
].filter(Boolean)
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
"@rails/webpacker": "^4.0.7",
|
"@rails/webpacker": "^4.0.7",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"bourbon": "~4.2.7",
|
"bourbon": "~4.2.7",
|
||||||
|
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||||
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||||
|
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
||||||
|
"babel-preset-env": "^1.7.0",
|
||||||
"chart.js": "~2.5.0",
|
"chart.js": "~2.5.0",
|
||||||
"dotenv": "^8.0.0",
|
"dotenv": "^8.0.0",
|
||||||
"emojione": "~2.2.7",
|
"emojione": "~2.2.7",
|
||||||
|
@ -37,10 +41,6 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
|
||||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
||||||
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
|
||||||
"babel-preset-env": "^1.7.0",
|
|
||||||
"eslint": "^5.13.0",
|
"eslint": "^5.13.0",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-config-prettier": "^4.0.0",
|
"eslint-config-prettier": "^4.0.0",
|
||||||
|
|
Loading…
Reference in a new issue