Open bahmutov opened 4 years ago
Alternative: try to use custom webpack config
@Component({
selector: 'app-hero-detail',
// using template string works
// template: '',
// using templateUrl does not work
templateUrl: './hero-detail.component.html',
styleUrls: [ './hero-detail.component.css' ]
})
The webpack config
const webpackOptions = {
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
use: [{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}, {
loader: 'angular2-template-loader?keepUrl=true'
}],
exclude: [/node_modules/],
},
{
test: /\.(css)$/,
loaders: ['to-string-loader', 'css-loader']
},
{
test: /\.(html)$/,
loader: 'raw-loader'
}
]
}
}
https://www.twilio.com/blog/2018/03/building-an-app-from-scratch-with-angular-and-webpack.html With
new HtmlWebpackPlugin({
template: __dirname + '/src/index.html',
output: __dirname + '/dist',
inject: 'head'
}),
Without redefining everything manually?
Seems like node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/test.js is a good candidate for grabbing the webpack configuration