I am developing an Angular module and after compiling and bundling it with ngc and rollup I am getting the following error in my Angular project:
Cannot find module "jquery/index"
In one of the module files I have the following import:
import * as jQuery from 'jquery';
In the module's UMD file the jquery import is declared as jquery/index
. When I change it to jquery
everything works as it should. However each time I rebuild and bundle the package I have to fix the problem again as rollup (or ngc) somehow changes the import from jquery
to jquery/index
.
So the main question is why the jquery import statement is changed after compiling and bundling?
My tsconfig:
{
"compilerOptions": {
"declaration": true,
"module": "es2015",
"target": "es5",
"baseUrl": ".",
"stripInternal": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"outDir": "../build",
"rootDir": ".",
"lib": [
"es2016",
"dom"
],
"skipLibCheck": true,
"types": []
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"skipTemplateCodegen": true,
"flatModuleOutFile": "chassis-core.js",
"flatModuleId": "chassis-core"
},
"files": [
"./index.ts"
]
}