即使我设置了loader: 'ts'
我也看到了这个错误:
50% 4/6 build modulesModuleParseError: Module parse failed: /home/rob/git/repo/src/app/container.entry.ts Unexpected token (16:70)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (16:70)
webpack.common.js
'use strict';
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: {
app: [
'./src/main.ts'
],
container: [
'./src/app/container.entry.ts'
],
containerPrereqs: [
'angular'
]
},
resolve: {
root: [ path.join(__dirname, 'node_modules')],
extensions: ['', '.ts', '.js']
},
module: {
rules: [{
test: /\.ts$/,
loader: 'ts'
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.css$/,
loaders: ['to-string-loader', 'css-loader']
}
]
}
};
来自package.json的片段:
"dependencies": {
"angular": "1.6.1",
"ts-loader": "^0.8.1",
"typescript": "2.3.3",
"css-loader": "^0.28.4",
"html-loader": "^0.4.3",
"to-string-loader": "^1.1.5",
"webpack": "^1.12.14"
},
答案 0 :(得分:1)