Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify nodeModules loader in CHANGELOG.md #1972

Merged
merged 1 commit into from
Mar 3, 2019

Conversation

oleksii-leonov
Copy link
Contributor

New nodeModules loader significantly change behavior.
It's specified in Breaking changes section but description is quite small.
This PR adds more details to CHANGELOG.md about nodeModules loader and receipt to keep previous behavior.

New `nodeModules` loader significantly change behavior.
It's specified in **Breaking changes** section but description is quite small.
This PR adds more details to `CHANGELOG.md` about `nodeModules` loader and receipt to keep previous behavior.
@gauravtiwari gauravtiwari merged commit 6355c8c into rails:master Mar 3, 2019
@gauravtiwari
Copy link
Member

thanks :)

@olimart
Copy link

olimart commented Apr 2, 2019

Hi @aleksejleonov . Where are we supposed to insert snippet?
The following has no effect.

const { environment } = require('@rails/webpacker')

// https://github.com/rails/webpacker/issues/1892
environment.loaders.delete('nodeModules');

module.exports = environment

Raises

ERROR in ./app/javascript/packs/application.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: [BABEL] /scaffold/scaffold/app/javascript/packs/application.js: (0 , _semver(...).coerce) is not a function (While processing: "/scaffold/babel.config.js$0")

@oleksii-leonov
Copy link
Contributor Author

Hi @olimart!

It should be inserted into config/webpack/environment.js.

Also, more detailed description in v4-upgrade guide https://github.com/rails/webpacker/blob/master/docs/v4-upgrade.md#excluding-node_modules-from-being-transpiled-by-babel-loader.

But due to error description, looks like you issue not related to nodeModules loader.

TypeError: [BABEL] /scaffold/scaffold/app/javascript/packs/application.js: (0 , _semver(...).coerce) is not a function (While processing: "/scaffold/babel.config.js$0")

It may be related to broken config in application.js or babel.config.js files.

Also, after applying changes to babel.config.js or config/webpack/environment.js it may be helpful to restart rails and webpack-dev-server and clean cached assets with rm -r tmp/cache/webpacker public/packs public/packs-test.

@olimart
Copy link

olimart commented Apr 2, 2019

Thanks @aleksejleonov will investigate further 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants