[英]Exclude node_modules but include one folder
I'm trying to make this emoji-picker work. 我正在尝试使此表情符号选择器正常工作。 But since it's a in node_modules I can't access it.
但是由于它是在node_modules中,所以我无法访问它。 My question is how to include only the folder that contains the emoji-picker files?
我的问题是如何仅包含包含表情符号选择器文件的文件夹? here is my webpack
这是我的webpack
var path = require('path')
module.exports = {
entry: './src/js/app.js',
output: {
filename: 'build.js',
path: path.resolve(__dirname, 'dist')
},
devServer: {
contentBase: path.join(__dirname, 'src'),
port: 4000,
public: 'localhost:4000'
},
devtool: 'cheap-eval-source-map',
module: {
rules: [
{
// set up standard-loader as a preloader
enforce: 'pre',
test: /\.jsx?$/,
loader: 'standard-loader',
exclude: /(node_modules)/,
// how to make this one work? so I can access it
include: path.resolve(__dirname, '/node_modules/onesignal-emoji-picker/'),
options: {
// Emit errors instead of warnings (default = false)
error: false,
// enable snazzy output (default = true)
snazzy: true
}
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
}
]
}
}
You're providing two conditions ( include
and exclude
) that will never be matched at the same time. 您要提供两个条件(
include
和exclude
),它们将不会同时匹配。
When using multiple conditions, all conditions must match.
使用多个条件时,所有条件都必须匹配。
Try to use a single condition, something like: 尝试使用单个条件,例如:
exclude: /node_modules\/(?!.*onesignal-emoji-picker).*$/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.