-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
For some unknown reason extracted CSS is only saved to disk once. All subsequent changes to CSS are no-op.
NODE_ENV is set to development.
Config:
{
"presets": ["es2015", "stage-0", "react"],
"plugins": ["transform-decorators-legacy", "transform-runtime", [
"css-modules-transform", {
"extractCss": "./build/assets/style.compiled.css",
"devMode": true
}
]]
}
This is the log from browser-sync:
[BS] File changed: build/components/Login.css
[BS] File changed: build/assets/style.compiled.css
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
[BS] File changed: build/components/Login.css
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
[BS] File changed: build/components/Login.css
[BS] File changed: build/components/Login.css
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
app/components/Login.js -> build/components/Login.js
[BS] File changed: build/components/Login.css
[BS] File changed: build/components/Login.js.map
[BS] File changed: build/components/Login.js
I wrote a somewhat test to verify that there is no issue with CSS compiler. Looking at console output everything is alright.
it('should recompile generated file', () => {
const called = [];
const dir = `${__dirname}/output`;
const input = `${dir}/input.css`;
const output = `${__dirname}/output/output.css`;
mkdirSync(dir);
const sources = ['.class { color: red; }', '.class { color: blue; }', '.class { color: green; }'];
for (const src of sources) {
writeFileSync(input, src, { encoding: 'utf8' });
const source = transform('fixtures/generated.js', {
extractCss: output,
processCss(css, filename) {
called.push(relative(__dirname, filename));
console.log(`PROCESSED ${filename}`);
return css;
}
}).code;
const generatedCSS = readFileSync(output, 'utf8');
console.log(`!!! COMPILED:\n\n${source}\n\n!!!\n\n`);
console.log(`!!! READ FILE: ${generatedCSS}`);
}
});I first run babel to precompile everything with the following options:
babel app/ --copy-files --out-dir build --source-maps true
Then I run two scripts in parallel:
Script that spins off Browser sync to reload browser on file changes:
babel-node scripts/serve.js
Babel with --watch option to recompile files on fly:
babel app/ --copy-files --out-dir build --source-maps true --watch --skip-initial-build
Metadata
Metadata
Assignees
Labels
No labels
