This inquiry pertains to webpack, TypeScript, and npm. Here is my folder structure:
.
-src
--apps
---TemplateInvestigate
Main.ts
-node_modules
--parse-json
index.js
---vendor
parse.js
unicode.js
In the Main.ts file within TemplateInvestage, I am attempting to import a JSON parser like so:
import * as a from "../../../node_modules/parse-json/index.js";
My Webpack configuration is as follows:
var ES5to3OutputPlugin = require("es5to3-webpack-plugin");
module.exports = {
entry: {
'TemplateInvestigate':"./src/apps/TemplateInvestigate/Main.ts"
},
output: {
filename: './dist/[name].jsx'
},
resolve: {
extensions: [ '.ts']
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
,plugins : [
new ES5to3OutputPlugin()
]
}
tsConfig setup:
"compilerOptions": {
// "module": "commonjs",
"noImplicitAny": false
, "noEmitOnError": true
, "removeComments": false
,"moduleResolution": "node"
,"allowJs" : true
,"baseUrl": "."
}
}
When running webpack, I encountered the following error message:
ModuleNotFoundError: Module not found: Error: Can't resolve './vendor/parse'
in 'K:\projectFolder\node_modules\parse-json'
...
Please note that there is no type definition file available for the parse-json package that was installed via npm.