webpack-fix-style-only-entries icon indicating copy to clipboard operation
webpack-fix-style-only-entries copied to clipboard

Not working for dynamically imported css?

Open arichter83 opened this issue 6 years ago • 2 comments

I tried this package, but it did not work for me. I created something to reproduce:

git clone -b using-MiniCssExtractPlugin https://github.com/arichter83/meteor-react-typescript-nightwatch.git
meteor npm install
meteor 

In Info.tsx there is a dynamic import:

import(/* webpackChunkName: "info" */ '../../client/info.css')

This will generate a info.js and a info.css:

I20190710-18:56:58.603(2)?     info.21e44ad1ca43ac862441.js  392 bytes    info  [emitted]  info
I20190710-18:56:58.603(2)?                         info.css   30 bytes    info  [emitted]  info

And the info.js will still be loaded in the client, even though I think it is obsolete:

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["info"],{

/***/ "./client/info.css":
/*!*************************!*\
  !*** ./client/info.css ***!
  \*************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./client/info.css?");

/***/ })

}]);

And in my webpack.config.js I use the plugin:

new FixStyleOnlyEntriesPlugin(),

Where is my mistake? Thank you for your help.

PS: I also added a StackOverflow question https://stackoverflow.com/questions/56937912/webpack-dynamic-import-scss-generates-tiny-js-files

arichter83 avatar Jul 10 '19 17:07 arichter83

I have the same problem

yaroslavvertukhov avatar Jul 01 '20 07:07 yaroslavvertukhov

@arichter83 Did you find a solution?

yaroslavvertukhov avatar Jul 01 '20 07:07 yaroslavvertukhov