不包括dir的Webpack不起作用..

时间:2016-01-22 00:14:33

标签: webpack

我正在尝试排除以下目录:\ src \ comps \ app3 \ movies \ 我的语法是:

config.module = {
    //preLoaders: [{test: /\.ts$/, loader: 'tslint'}], // no need since I am using WebStorm to lint
    loaders: [
        // Support for .ts files.
        {
            test: /\.ts$/,
            loader: 'ts',
            query: {
                'ignoreDiagnostics': [
                    2403, // 2403 -> Subsequent variable declarations
                    2300, // 2300 -> Duplicate identifier
                    2374, // 2374 -> Duplicate number index signature
                    2375  // 2375 -> Duplicate string index signature
                ]
            },
            exclude: [/\.(spec|e2e)\.ts$/, path.resolve(__dirname, "src/comps/app3/movies"), /node_modules\/(?!(ng2-.+))/]
        },

我也尝试过/ movies /以及/movies/.ts$ 但Webpack总是尝试并进入电影目录...

不知道为什么......赞赏任何建议

肖恩

1 个答案:

答案 0 :(得分:1)

发现问题,如果你使用" exclude":[...在你的tsconfig.ts中,webpack将忽略你在webpack.config中指定的排除...所以你需要指定只在两个地方中的一个...希望它有助于某人...