Closed gremo closed 2 years ago
I'm trying to add a custom rule, which should use only style-loader and css-loader. This rule will be activated with .css files and when resource query is "uncritical", i.e. mystyle.css?uncritical:
style-loader
css-loader
.css
mystyle.css?uncritical
.addLoader({ test: /\.css$/, resourceQuery: /uncritical/, use: [ { loader: 'style-loader', options: { injectType: "lazyStyleTag", insert: "body" } }, 'css-loader' ] })
Then in app.js:
app.js
import styles from '@fortawesome/fontawesome-pro/css/fontawesome.css?uncritical';
Syntax Error: ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): SyntaxError (1:1) node_modules\@fortawesome\fontawesome-pro\css\fontawesome.css > Unknown word 1 | import api from "!../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js"; | ^ 2 | import content from "!!../../../css-loader/dist/cjs.js!./fontawesome.css?uncritical"; 3 |
Syntax Error: ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): SyntaxError
(1:1) node_modules\@fortawesome\fontawesome-pro\css\fontawesome.css > Unknown word
1 | import api from "!../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js"; | ^ 2 | import content from "!!../../../css-loader/dist/cjs.js!./fontawesome.css?uncritical"; 3 |
I can't understand why postcss-loader is being used here. Any help is much appreciated.
Well, closing because I messed up with addLoader and addRule.
I'm trying to add a custom rule, which should use only
style-loader
andcss-loader
. This rule will be activated with.css
files and when resource query is "uncritical", i.e.mystyle.css?uncritical
:Then in
app.js
:import styles from '@fortawesome/fontawesome-pro/css/fontawesome.css?uncritical';
I can't understand why postcss-loader is being used here. Any help is much appreciated.