I am encountering some difficulties with webpack when trying to build my files. I keep getting a series of errors that all have the same format, such as:
ERROR in ./node_modules/typescript-rest/dist/server.js
Module not found: Error: Can't resolve 'typescript-ioc/es6' in '/Users/Jack/NODE/ts-rest-session/node_modules/typescript-rest/dist'
It appears that there is an issue with loading node_modules correctly.
tsc and ts-node are both able to successfully build/run the project. Below are my configurations:
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"lib": ["es2015", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
webpack.config.js
module.exports = {
entry: {
server: './server.ts'
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
modules: ["node_modules"]
extensions: ['.tsx', '.ts', '.js', '.json']
},
output: {
filename: '[name].bundle.js',
path: __dirname + 'dist'
}
};
If anyone has any suggestions or ideas, please feel free to share! I have attempted removing node_modules
from the exclude section of module.rules[0] in webpack.config.json but to no avail.