Closed joelmoss closed 5 years ago
Can you share the webpack- and postcss-config file you´ve used that lead to this issue?
Are you using the force
option?
postcssNormalize({
forceImport: true
});
I can confirm problem at least for recompile with webpack-dev-server.
Example config can be found here.
To reproduce:
git clone https://github.com/germn/webpack_dev_server_issue_1623
cd webpack_dev_server_issue_1623
npm install
npm run static-dev-server
static_meta/tags.html
to see css urlstatic_src/app/index.css
to recompileIssue appears regardless of using forceImport
.
I am experiencing the same behavior running through the PostCSS Express middleware.
app.js:
app.use('/css/:style.css', postcssMiddleware({
src(req) {
const filename = req.params.style;
return path.join(__dirname, 'public/stylesheets', `${filename}.pcss`);
},
plugins: [
postcssNormalize({ browsers: 'last 2 versions' }),
],
}));
styles.pcss:
@import-normalize;
/* My custom rules */
First request to http://localhost:3000/css/styles.css
has the normalize.css rules before the custom rules. Subsequent requests do not (regardless of whether the source has changed).
I think this will be better handled in the next release, when I am more conservatively attaching normalize.css.
Resolved in v8 😄
I've included this lib and the first time webpack builds, normalize is included fine, but after a second compile (after a css change somewhere else), normalize is no longer imported.
Any ideas?