Closed fengxinming closed 5 years ago
提 PR 直接加上吧。
@sorrycc 我在本地直接加上global.styl
调试报错,一直没排查出来才提了个issue。
报什么错?
@sorrycc 大佬看一下 .umirc.js 部分配置,其它styl文件都能被正常解析
{
urlLoaderExcludes: [
/\.styl$/,
],
chainWebpack(config) {
const rule = new UmiRule(config, {
modules: true
});
rule.useStylus();
return config;
},
}
报错
error in ./src/global.styl
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
Error: Didn't get a result from child compiler
at childCompiler.runAsChild (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/mini-css-extract-plugin/dist/loader.js:144:23)
at compile (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:306:11)
at hooks.afterCompile.callAsync.err (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:631:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/Hook.js:154:20)
at compilation.seal.err (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:628:31)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/Hook.js:154:20)
at hooks.optimizeAssets.callAsync.err (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compilation.js:1325:35)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at runLoaders (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/NormalModule.js:302:20)
at /Users/jesse/github/my-github/react-starter/react-umi/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /Users/jesse/github/my-github/react-starter/react-umi/node_modules/loader-runner/lib/LoaderRunner.js:182:20
at context.callback (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at childCompiler.runAsChild (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/mini-css-extract-plugin/dist/loader.js:144:14)
at compile (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:306:11)
at hooks.afterCompile.callAsync.err (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:631:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/tapable/lib/Hook.js:154:20)
at compilation.seal.err (/Users/jesse/github/my-github/react-starter/react-umi/node_modules/webpack/lib/Compiler.js:628:31)
@ ./src/routes/.umi/umi.js 179:0-28
@ multi ./node_modules/af-webpack/lib/webpackHotDevClient.js ./src/routes/.umi/umi.js
https://github.com/fengxinming/react-starter/tree/master/react-umi 这是demo地址,有必要的话可以用这个demo,加上global.styl文件调试,umi-build-dev/lib/plugins/global-css.js
这个也要相应改一下
我们没 stylus 的需求,但不排斥对 stylus 的支持。所以,有需求可以直接提 PR 加上。
@sorrycc 你大概讲一下关键代码在哪里,因为我已经在chainWebpack里面加入了stylus的支持,组件内引入都正常
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
在添加stylus-loader的情况下,不支持自动导入 global.styl
查看源码发现
umi-build-dev/src/plugins/global-css.js
未定义
global.styl
,希望可以在配置文件中定义,或者添加该支持