Open kentandersen opened 6 years ago
When importing files without assignment './styles.css', importPathFormatter is not executed and the import path is not changed.
'./styles.css'
importPathFormatter
When importing with assignment import styles from './styles.css', importPathFormatter is called as expected.
import styles from './styles.css'
index.js
import './style.css'; export default function(n) { return n+1; }
style.css
.abc { background: green; }
Babel config
{ "preprocessCss": "./scripts/precompile.js", "keepImport": true, "extensions": [".css", ".scss"], "generateScopedName": "[local]", "importPathFormatter": "./scripts/renameImports.js", "extractCss": { "dir": "./lib/", "relativeRoot": "./src/", "filename": "[path]/[name].css" } }
When importing files without assignment
'./styles.css'
,importPathFormatter
is not executed and the import path is not changed.When importing with assignment
import styles from './styles.css'
,importPathFormatter
is called as expected.index.js
style.css
Babel config