【发布时间】:2017-03-08 20:56:25
【问题描述】:
我正在尝试将 css 文件与 webpack extract-text-webpack-plugin 捆绑在一起,它适用于 int (projects)/src/assets/styles 的本地文件,但我还需要来自 node_modules 的 bootstrap.css,如果我尝试将其添加到 import b from 'bootstrap/dist/css/bootstrap.css';该插件只是抛出一个听起来像这样的错误“bootstrap.css Unexpected token (7:5) You may need a proper loader to handle this file type.”如果我添加'!style!css!'如本问题所述 Webpack Error while including bootstrap 3 它确实有效,但现在它被注入到 index.html 中,这可能会减慢整个应用程序的速度。那么如何正确地从 node_modules 加载引导样式呢?我尝试使用 copy-webpack-plugin 复制它,但复制是在加载器完成工作后执行的。那么有什么建议吗?
【问题讨论】:
-
如果 bootstrap 被加载到 head 它会覆盖上面出现的任何文件,例如
标签: javascript twitter-bootstrap webpack