Reputation: 924
I am learning angular for about a month. I am following a series of video that I've found in internet. I got stuck here in this error as shown in picture below.
webpack.server.config.js code
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: { server: './server.ts' },
resolve: { extentions: ['.js', '.ts'] },
externals: [/{node_modules|main\..*\.js}/],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: {
test: /\.ts$/,
loader: 'ts-loader'
}
},
plugins: [
new webpack.ContextReplacementPlugin(
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'),
{}
),
new webpack.ContextReplacementPlugin(
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
]
}
Upvotes: 0
Views: 46
Reputation: 38103
The clues are right there in the error message. rules
needs to be an array of objects, not a single object; and extensions
is spelled with an s
where you have a second t
.
Here is the fixed version:
webpack.server.config.js code
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: { server: './server.ts' },
resolve: { extensions: ['.js', '.ts'] }, // CHANGED
externals: [/{node_modules|main\..*\.js}/],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [{ // CHANGED
test: /\.ts$/,
loader: 'ts-loader'
}] // CHANGED
},
plugins: [
new webpack.ContextReplacementPlugin(
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'),
{}
),
new webpack.ContextReplacementPlugin(
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
]
}
Upvotes: 1