webpack上的通配符入口点usng glob出错了

时间:2017-02-15 03:35:51

标签: javascript webpack

尝试为我的所有js文件进行通配符匹配,但是我收到了此错误

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

这是我配置webpack文件的方式。

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'
  }
}

上面的webpack.config.js出了什么问题?它对我来说没问题。

1 个答案:

答案 0 :(得分:1)

entries/*js - > entries/*.js

那怎么样?