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

How can I bundle assets (i.e css files) from node_modules that required in node_modules? #127

Open
krutoo opened this issue Jan 19, 2023 · 1 comment

Comments

@krutoo
Copy link

krutoo commented Jan 19, 2023

Hi, i use example from here:

https://github.com/liady/webpack-node-externals#how-can-i-bundle-required-assets-ie-css-files-from-node_modules

But looks like it works only when css file import places at source code of project

It is not working when i import file from node_modules that imports css file

How can i fix that?

Example of source code:

// import css WORKS
import "./test.css";

// import css-modules WORKS
import styles from "./test.module.css";

// import css-modules from node_modules WORKS
import somethingStyles from "some-lib/something/something.module.scss";

// import module from node_modules that has imports of css-modules ERROR
import { Something } from "some-lib/something";

Example of webpack config:

{
  target: 'node',
  externalsPresets: { node: true },
  externals: nodeExternals({
    allowlist: [/\.(?!(?:js|json)$).{1,5}$/i],
  }),
  // ...
}
@sushmitg
Copy link

I am having similar issue with 'react-day-picker' v7

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

No branches or pull requests

2 participants