Last active
May 30, 2019 20:44
-
-
Save d-simon/faeda344a2c1a13b24c41e4eed041ac3 to your computer and use it in GitHub Desktop.
Rails 6.0.0.rc1 fresh install throws the webpack error as described in https://github.com/rails/webpacker/issues/2109
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 is automatically compiled by Webpack, along with any other files | |
// present in this directory. You're encouraged to place your actual application logic in | |
// a relevant structure within app/javascript and only use these pack files to reference | |
// that code so it'll be compiled. | |
require("@rails/ujs").start() | |
require("turbolinks").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
// Uncomment to copy all static images under ../images to the output folder and reference | |
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) | |
// or the `imagePath` JavaScript helper below. | |
// | |
// const images = require.context('../images', true) | |
// const imagePath = (name) => images(name, true) |
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
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' | |
} | |
} | |
], | |
(isProductionEnv || isDevelopmentEnv) && [ | |
require('@babel/preset-env').default, | |
{ | |
forceAllTransforms: true, | |
useBuiltIns: 'entry', | |
corejs: 3, | |
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, | |
corejs: 3 | |
} | |
], | |
[ | |
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
const { environment } = require('@rails/webpacker') | |
module.exports = environment |
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
{ | |
"name": "LifeRPG", | |
"private": true, | |
"dependencies": { | |
"@rails/actioncable": "^6.0.0-alpha", | |
"@rails/activestorage": "^6.0.0-alpha", | |
"@rails/ujs": "^6.0.0-alpha", | |
"@rails/webpacker": "^4.0.5", | |
"turbolinks": "^5.2.0" | |
}, | |
"version": "0.1.0", | |
"devDependencies": { | |
"webpack-dev-server": "^3.4.1" | |
} | |
} |
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
node -v | |
v10.15.3 | |
rails --version | |
Rails 6.0.0.rc1 | |
ruby --version | |
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment