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 to use 'mini-css-extract-plugin' in razzle config #1931

Open
AnshuBansal6 opened this issue Jun 1, 2024 · 1 comment
Open

How to use 'mini-css-extract-plugin' in razzle config #1931

AnshuBansal6 opened this issue Jun 1, 2024 · 1 comment

Comments

@AnshuBansal6
Copy link

I am getting this error -

Could not find a declaration file for module 'mini-css-extract-plugin'. '/..t/node_modules/mini-css-extract-plugin/dist/cjs.js' implicitly has an 'any' type.
Try npm i --save-dev @types/mini-css-extract-plugin if it exists or add a new declaration (.d.ts) file containing declare module 'mini-css-extract-plugin';

@dmitryshelomanov
Copy link

mini-css-extract-plugin in razzle by default

But if you want to customize it

const MiniCssExtractPlugin = require('mini-css-extract-plugin');

function patchMiniCssExtractorOptions({ plugins }) {
  const plugin = plugins.find(plugin => plugin instanceof MiniCssExtractPlugin);

  if (plugin) {
    plugin.options.ignoreOrder = true;
  }
}

Pass it to modifyWebpackConfig

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