[英]How to configure webpack to only bundle files within a directory?
I've a folder structure for my project that looks roughly like this: 我的项目的文件夹结构看起来大致如下:
myproject
|-- some-folder
| `-- src
| `-- index.tsx
|-- src
| |-- components
| | `-- files.tsx
| `-- index.tsx
`-- webpack.config.js
When I run webpack, it tries to bundle the index.tsx
file in both src
and some-folder
. 当我运行webpack时,它会尝试将
index.tsx
文件捆绑在src
和some-folder
。
This would then throw an error because the index.tsx
file in some-folder
has certain dependencies webpack cannot resolve since is not meant to be bundled together. 这将导致错误,因为
some-folder
的index.tsx
文件具有某些依赖关系webpack无法解析,因为它不打算捆绑在一起。
This is how I've configured my webpack's entry point: 这就是我配置webpack的入口点的方法:
var config = {
context: __dirname + '/src',
entry: {
app: './index.tsx'
}
}
How can I configure webpack to only look for files within the src
folder and not else where unless I define another different full path in the entry point? 如何配置webpack只查找
src
文件夹中的文件而不是其他除非我在入口点定义另一个不同的完整路径?
看到这已经很老了,它可能已经解决了,但它是否与添加“exclude”语句有关,以确保省略“/ some-folder”?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.