1

我正在尝试加载 handlebars-loader enter code here,但我的应用程序挂起。它加载app.bundle.js但不执行任何其他脚本。控制台没有输出。

module.exports = {
     module: {
         loaders: [{
                 exclude: /node_modules/,
                 loader: 'handlebars-loader'
             }, {
                 test: /\.js$/,
                 exclude: /node_modules/,
                 loader: 'babel-loader'
             }]
     }
};

当我尝试handlebars通过插件加载时:

plugins: [
          new webpack.ProvidePlugin({
             handlebars: "handlebars",
             "windows.handlebars": "handlebars"
         })
     ],

我已经handlevars定义但webpack在编译后给出了错误:

ERROR in ./~/handlebars/lib/index.js
Module not found: Error: Can't resolve 'fs' in 'E:\Dev\Micron\node_modules\handlebars\lib'
 @ ./~/handlebars/lib/index.js 17:11-24
 @ ./src/core/index.js
 @ ./src/app.js

如何handlebars通过 webpack 加载?

4

0 回答 0