admin管理员组文章数量:1566220
webpack 3.8.1 使用 extract-text-webpack-plugin 3.0.2 抽取css时失败,报错: ERROR in ./src/static/style/localTime.css Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type. | .localTimeBox { | color: red; | } @ ./node_modules/style-loader!./src/static/style/localTime.css 4:14-42 webpack-build.config.js 配置为:
module: { loaders: [ { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'style-loader!css-loader', {publicPath: '../'}) } ] },
plugins: [ new ExtractTextPlugin('css/bundle.min.css', {allChunks: true}), ]
解决方法:
将webpack-build.config.js 配置改为:
module: { loaders: [ { test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: ['css-loader'], publicPath: '../' }) } ] },
plugins: [ new ExtractTextPlugin('css/bundle.min.css', {allChunks: true}), ]
问题就解决了。具体原因好像是版本的写法问题。
转载于:https://wwwblogs/Man-Dream-Necessary/p/8508859.html
本文标签: ExtractTextwebpackPluginLoader
版权声明:本文标题:webpack 3.8 使用 extract-text-webpack-plugin 3.0 抽取css失败:You may need an appropriate loader to handle ... 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1726298707a1064895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论