wildcard entry point usng glob on webpack got erro

2019-09-06 03:24发布

Trying to do wildcard matching for all my js file but I got this error

var elements = request.replace(/^-?!+/, "").replace(/!!+/g, "!").split("!");
                                               ^

TypeError: request.replace is not a function
    at C:\Users\Superant-Laptop\Projects\seeties-webapp\node_modules\webpack\lib\NormalModuleFactory.js:72:27

This is how I configure my webpack file.

function toObject(paths) {
  console.log(paths)
  var ret = {};

  paths.forEach(function(path) {
    ret[path.split('/').slice(-1)[0]] = path;
  });

  return ret;
}

module.exports = {
  entry: [
    'webpack/hot/dev-server',
    'webpack-hot-middleware/client', 
    toObject(glob.sync(path.join(__dirname, 'resources/assets/bundle/entries/*js')))
  ],
  output: {
    path: path.join(__dirname, 'public'),
    publicPath: '/',
    filename: 'app.js'
  }
}

what's wrong with my webpack.config.js above? It looks ok for me.

1条回答
爷的心禁止访问
2楼-- · 2019-09-06 03:59

entries/*js -> entries/*.js

how about that?

查看更多
登录 后发表回答