Webpack转换我不想要的文件,例如.json文件

时间:2018-07-19 23:00:10

标签: node.js webpack

我真的只是希望webpack接收前三个文件,但是它要吸收更多文件。

它甚至占用了webpack.config.js,这似乎非常错误。我不确定为什么会这样。

我只想转换mutateindexcli

请问您能帮忙吗?

[0] ./src/mutate.js 4.46 KiB {0} [built]
[5] ./src/index.js 463 bytes {0} [built]
[8] ./src/cli.js 238 bytes {0} [built]
[14] ./examples/input/0.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[15] ./examples/input/1.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[16] ./examples/input/2.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[17] ./examples/output/0.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[18] ./examples/output/1A.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[19] ./examples/output/1B.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[20] ./examples/output/2B.json 1.81 KiB {0} [optional] [built] [failed] [1 error]
[21] ./package.json 1.65 KiB {0} [optional] [built] [failed] [1 error]
[22] ./webpack.config.js 549 bytes {0} [optional] [built]
[30] (webpack)/buildin/harmony-module.js 573 bytes {0} [built]
[41] ./node_modules/colors/lib sync 160 bytes {0} [optional] [built]
[42] . sync ^\.\/.*$ 829 bytes {0} [built]

配置:

const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
  entry: './src/index.js',
  plugins: [
    new CleanWebpackPlugin(['dist']),
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        use: 'babel-loader',
        exclude: [
          /node_modules/, /__tests__/,
        ],
      },
      {
        test: /\.md$/,
        use: 'ignore-loader',
      },
      {
        test: /\.json$/,
        use: 'ignore-loader',
      },
    ],
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  node: {
    fs: 'empty',
  },
};

0 个答案:

没有答案