I am still trying to work through #1917. I figured trying out Webpack 4 might be a better use of time.
Here were my upgrade steps:
I then ran bundle exec rails webpacker:install which generated the issue below.
Is there a step related to babel I am missing?
BTW: Here is what I changed: https://github.com/scottwater/rails_webpacker_with_purgecss_example/tree/webpack4
Thanks,
Scott
Hash: 3c68802e3c8f91684ac4
Version: webpack 4.29.0
Time: 451ms
Built at: 01/29/2019 3:16:56 PM
2 assets
Entrypoint application = js/application-3b4deecf7a37050034af.js js/application-3b4deecf7a37050034af.js.map
[0] ./app/javascript/packs/application.js 2.85 KiB {0} [built] [failed] [1 error]
ERROR in ./app/javascript/packs/application.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'babel-plugin-syntax-dynamic-import' from '/Users/scott/play/webpack_with_purge'
Apologies. I missed deleting/migrating the .babelrc file.
This bit me as well. Simply deleting the file worked.
I learned by reading this thread that I also missed deleting the .babelrc. Let me pretend for a little while longer that I know what I am doing :)
I learned by reading this thread that I also missed deleting the
.bablelrc. Let me pretend for a little while longer that I know what I am doing :)
Watchout for @jaykilleen's comment above. I went to check if I had that file by copy/pasting it. I thought I didn't and I actually did (he mispelled .babelrc as .bablelrc). Just saving people some headaches...
Thanks @benlieb for pointing that out. I've edited my comment. Glad I'm helping people though :) sorry for the headscratcher.
I came to this issue since I met the same problem. But I can not understand what you guys mean yet
I came to this issue since I met the same problem. But I can not understand what you guys mean yet
@Uysim If you have this problem you may need to delete your .babelrc file
@benlieb correct. thank you
Why does this file need to be deleted? I have plugins such as transform-class-properties which need to be used. Is there somewhere else this config should go now?
Is there somewhere else this config should go now?
@Qwertie- See: https://github.com/rails/webpacker/blob/master/docs/v4-upgrade.md#webpacker-upgrade-guide
I learned by reading this thread that I also missed deleting the
.babelrc. Let me pretend for a little while longer that I know what I am doing :)
same here, hahaha
Don't forget about the babel section in your package.json, if you don't use .babelrc for some reason
Thank you, had the same issue and deleting the file worked for me too. :)
I'm not sure how this turned into a reddit post, but I also found that removing the .babelrc file resolved my issue... and created others
Most helpful comment
Apologies. I missed deleting/migrating the .babelrc file.