我正在使用 Truffle v3.1.2 开发 Dapp,它是 Ethereum 的开发框架。我在节点上为这个 dapp 使用 Angular 不幸的是我对节点和 webpack 非常陌生。我将视图存储在 /views 文件夹中,图像存储在 /images文件夹,我需要一些帮助来修改 webpack.config.js 文件。我正在使用“npm run dev”来部署它,我收到“错误:[$compile:tpload] 无法加载模板:views/main.html (HTTP 状态:404 Not Found)”消息。请在下面找到 webpack.config.js 文件。
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: [
'./app/bower_components/angular/angular.js',
'./app/bower_components/angular-route/angular-route.js',
'./app/javascripts/app.js',],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'app.js'
},
plugins: [
// Copy our app's index.html to the build folder.
new CopyWebpackPlugin([
{ from: './app/index.html', to: "index.html" }
])
],
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
],
loaders: [
{ test: /\.json$/, use: 'json-loader' },
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: ['transform-runtime']
}
}
]
}
}