-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Depfu triggered a Rails webpacker upgrade without incident but the official doc recommended certain steps: https://github.com/rails/webpacker/blob/master/docs/v4-upgrade.md https://webpack.js.org/migrate/4/ It appears that previous independent updates of babel etc. have actually handled many of these steps.
- Loading branch information
James Glover
committed
Mar 8, 2019
1 parent
c3dce7f
commit b5d7b62
Showing
8 changed files
with
2,373 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
module.exports = function(api) { | ||
var validEnv = ['development', 'test', 'production'] | ||
var currentEnv = api.env() | ||
var isDevelopmentEnv = api.env('development') | ||
var isProductionEnv = api.env('production') | ||
var isTestEnv = api.env('test') | ||
|
||
if (!validEnv.includes(currentEnv)) { | ||
throw new Error( | ||
'Please specify a valid `NODE_ENV` or ' + | ||
'`BABEL_ENV` environment variables. Valid values are "development", ' + | ||
'"test", and "production". Instead, received: ' + | ||
JSON.stringify(currentEnv) + | ||
'.' | ||
) | ||
} | ||
|
||
return { | ||
presets: [ | ||
isTestEnv && [ | ||
require('@babel/preset-env').default, | ||
{ | ||
targets: { | ||
node: 'current', | ||
chrome: 49, | ||
firefox: 52, | ||
browsers: '> 1%' | ||
} | ||
} | ||
], | ||
(isProductionEnv || isDevelopmentEnv) && [ | ||
require('@babel/preset-env').default, | ||
{ | ||
forceAllTransforms: true, | ||
useBuiltIns: 'entry', | ||
modules: false, | ||
exclude: ['transform-typeof-symbol'] | ||
} | ||
] | ||
].filter(Boolean), | ||
plugins: [ | ||
require('babel-plugin-macros'), | ||
require('@babel/plugin-syntax-dynamic-import').default, | ||
isTestEnv && require('babel-plugin-dynamic-import-node'), | ||
require('@babel/plugin-transform-destructuring').default, | ||
[ | ||
require('@babel/plugin-proposal-class-properties').default, | ||
{ | ||
loose: true | ||
} | ||
], | ||
[ | ||
require('@babel/plugin-proposal-object-rest-spread').default, | ||
{ | ||
useBuiltIns: true | ||
} | ||
], | ||
[ | ||
require('@babel/plugin-transform-runtime').default, | ||
{ | ||
helpers: false, | ||
regenerator: true | ||
} | ||
], | ||
[ | ||
require('@babel/plugin-transform-regenerator').default, | ||
{ | ||
async: false | ||
} | ||
] | ||
].filter(Boolean) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
plugins: [ | ||
require('postcss-import'), | ||
require('postcss-flexbugs-fixes'), | ||
require('postcss-preset-env')({ | ||
autoprefixer: { | ||
flexbox: 'no-2009' | ||
}, | ||
stage: 3 | ||
}) | ||
] | ||
} |
Oops, something went wrong.