Build error when trying to remove webpack MiniCssExtractPlugin plugin
See original GitHub issueDo 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:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
@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.
@billdami Check out https://github.com/rschristian/preact-ts-widget/