Skip to content

Upgrading from 3.5 to 4.0.0.rc.7 - Cannot find module 'babel-plugin-syntax-dynamic-import' #1923

@scottwater

Description

@scottwater

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:

  1. change the gem version to gem 'webpacker', '>= 4.0.x'
  2. bundle update webpacker
  3. yarn add @rails/webpacker@next
  4. bundle exec rails webpacker:install I let it overwrite everything except production.js.
  5. Copy the plugin from .postcssrc.yml to postcss.config.js.
    6.Rm .postcssrc.yml and .bablelrc
  6. yarn upgrade

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'

  • Did you mean "@babel/syntax-dynamic-import"?
    at Function.module.exports [as sync] (/Users/scott/play/webpack_with_purge/node_modules/resolve/lib/sync.js:58:15)
    at resolveStandardizedName (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePlugin (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
    at loadPlugin (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
    at createDescriptor (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at items.map (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map ()
    at createDescriptors (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPluginDescriptors (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
    at plugins (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-descriptors.js:40:19)
    at mergeChainOpts (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-chain.js:319:26)
    at /Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-chain.js:283:7
    at buildRootChain (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/config-chain.js:120:22)
    at loadPrivatePartialConfig (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/partial.js:85:55)
    at Object.loadPartialConfig (/Users/scott/play/webpack_with_purge/node_modules/@babel/core/lib/config/partial.js:110:18)
    at Object. (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:140:26)
    at Generator.next ()
    at asyncGeneratorStep (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:5:364
    at new Promise ()
    at Object. (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:5:97)
    at Object._loader (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:220:18)
    at Object.loader (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:56:18)
    at Object. (/Users/scott/play/webpack_with_purge/node_modules/babel-loader/lib/index.js:51:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions