cssスタイルがコンポーネントjsファイルに直接インポートされた場合、 docz dev
スローエラー:
Failed to compile.
./src/components/Button/index.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> .button-v1 {
| border-radius: 20px;
| font-family: 'roboto_medium';
webpackの設定を変更する必要があると思います。
doczrc.js
:
〜jsmodifyBundlerConfig:bundleConfig => {constルール=[{{テスト:/。css $ /、ローダー:「style-loader!css-loader」}];bundlerConfig.module.rules.push(... rules);bundlerConfigを返します。}〜
package.json
:
〜json"devDependencies":{"css-loader": "^ 2.1.0"、"スタイルローダー": "^ 0.23.1"}〜
ドキュメント: https ://www.docz.site/documentation/project-configuration#build -pipeline
webpackの設定を変更する必要があると思います。
doczrc.js
:modifyBundlerConfig: bundlerConfig => { const rules = [ { test: /\.css$/, loader: "style-loader!css-loader" } ]; bundlerConfig.module.rules.push(...rules); return bundlerConfig; }
package.json
:"devDependencies": { "css-loader": "^2.1.0", "style-loader": "^0.23.1" }
ドキュメント: https ://www.docz.site/documentation/project-configuration#build -pipeline
うん、その動作。 ありがとう)
上記の解決策を試しましたが、うまくいきませんでした。 ロールアップ構成でdoczを使用しています。 このブランチdocz-cssを確認してください。
docz-plugin-cssでも同じエラーが発生します
最も参考になるコメント
webpackの設定を変更する必要があると思います。
doczrc.js
:〜jsmodifyBundlerConfig:bundleConfig => {constルール=[{{テスト:/。css $ /、ローダー:「style-loader!css-loader」}];bundlerConfig.module.rules.push(... rules);bundlerConfigを返します。}〜package.json
:〜json"devDependencies":{"css-loader": "^ 2.1.0"、"スタイルローダー": "^ 0.23.1"}〜ドキュメント: https ://www.docz.site/documentation/project-configuration#build -pipeline