[英]Using bower modules with Webpack 2
I am new to Webpack and I started with Webpack2. 我是Webpack的新手,我开始使用Webpack2。 I can't manage to use require or import of modules from bower_components folder.
我无法使用bower_components文件夹中的require或import模块。 Is it possible to do so and if it is can you provide me an example or something.
是否可以这样做,如果可以的话,你可以给我一个例子或者什么。
This is my webpack.config file: 这是我的webpack.config文件:
You can configure resolve.modules
to also look in bower_components
. 您可以配置
resolve.modules
也看在bower_components
。
resolve: {
modules: ['bower_components', 'node_modules']
}
This will first look into bower_components
and if it can't find the module it will look into node_modules
. 这将首先查看
bower_components
,如果它找不到模块,它将查看node_modules
。 If you don't inlcude node_modules
you won't be able to use packages installed from npm. 如果您不包含
node_modules
,则无法使用从npm安装的软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.