question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build error when trying to remove webpack MiniCssExtractPlugin plugin

See original GitHub issue

Do you want to request a feature or report a bug?

Bug What is the current behaviour?

Preact-cli cannot build if I try to remove the MiniCssExtractPlugin plugin from within the preact.config file.

If the current behaviour is a bug, please provide the steps to reproduce. 1.I set up a brand new preact project using the preact create simple test command 2.I have a preact.config.js file in the root folder. Inside I have the following code :

export default (config, env, helpers) => {
   const { index } = helpers.getPluginsByName(config, 'MiniCssExtractPlugin')[0];
   config.plugins.splice(index, 1)
};

3.When I run npm run build I get the following error:

`Build [== ] 10% (0.3s) building/home/dev/workspace/test/node_modules/neo-async/async.js:16 throw new Error(‘Callback was already called.’); ^

Error: Callback was already called. `

What is the expected behaviour?

Removing the MiniCssExtractPlugin plugin so that I can have a build that contains all the needed js+css in one single file.

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.

Please paste the results of preact info here.

Environment Info:
  System:
    OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
  Binaries:
    Node: 10.21.0 - /usr/bin/node
    npm: 6.11.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 83.0.4103.106
    Firefox: 77.0.1
  npmPackages:
    preact: ^10.1.0 => 10.4.4 
    preact-cli: ^3.0.0-rc.6 => 3.0.0-rc.14 
    preact-render-to-string: ^5.1.2 => 5.1.9 
  npmGlobalPackages:
    preact-cli: 3.0.0-rc.14

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rschristiancommented, Mar 19, 2021

@billdami

Had a bit more time, made a few more touch ups. CSS will be automatically injected into the head now.

I’d also like to say you probably should be using ES/Modern output from Microbundle. It’s smaller and will be supported in all recent browsers. Modern, the absolute latest you can go, sees 95% global adoption. ES gets a couple more points. UMD is likely super unnecessary.

Also, removing the --no-compress saves you like 1/3 of the bundle, so you will likely want compression.

Feel free to add a `<script src="../dist/index.js"></script>" into that HTML template and just load in in your browser to test it out. Should fulfill your needs, hopefully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MiniCssExtractPlugin error when I run npm run build
Another says to delete node_modules and package.lock.json, both of these didn't work for me. Here is what my package.json: { "name" ...
Read more >
MiniCssExtractPlugin - webpack
It supports On-Demand-Loading of CSS and SourceMaps. It builds on top of a new webpack v5 feature and requires webpack 5 to work....
Read more >
Webpack error after upgrading mini-css-extract-plugin@1.6.2
How do I resolve? The only solution I have found so far is to downgrade to mini-css-extract-plugin@1.2.1 which just works, everytime. But ...
Read more >
`npm run build`, error `TypeError: MiniCssExtractPlugin is not ...
There is an update to mini-css-extract-plugin in version 2.5.0. I temporarily fixed it by adding in package.json: Support me by becoming a Medium...
Read more >
mini-css-extract-plugin - npm
extracts CSS into separate files. Latest version: 2.7.2, last published: 23 days ago. Start using mini-css-extract-plugin in your project by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found