I'm building an npm package that depends on @angular/material
.
I've included in my package.json
(hiding irrelevant info)
{
"main": "dist/index.js",
"module": "dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "ngc"
},
"peerDependencies": {
"@angular/core": ">=4.0.0 <5.0.0 || >=4.0.0-beta <5.0.0",
"@angular/animations": "^5.2.0",
"@angular/cdk": "^5.0.4",
"@angular/material": "^5.0.4",
"hammerjs": "^2.0.8",
},
"devDependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.4.6",
"@angular/compiler-cli": "^4.4.6",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/animations": "^5.2.0",
"@angular/cdk": "^5.0.4",
"@angular/material": "^5.0.4",
"hammerjs": "^2.0.8",
"core-js": "^2.4.1",
"rollup": "^0.50.0",
"rxjs": "^5.4.1",
"typescript": "^2.6.1",
"uglify-js": "^3.1.6",
"zone.js": "^0.8.4"
}
}
I build the package with ./node_modules/.bin/ngc
without any problem. But when I use this package in my local project, I'm getting the following error:
ERROR in /Users/me/myPackage/dist/myPackage.module.js
Module not found: Error: Can't resolve '@angular/material/slider/' in '/Users/me/myPackage/dist'
@ /Users/me/myPackage/dist/morpheus.module.js 49:0-60
@ /Users/me/myPackage/dist/index.js
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.