我有一个Angular2(4.0.0-rc.2)应用程序,Webpack配置为使用HMR功能,我也使用webpack-dll-bundles-plugin在Dev环境中创建dll,我想使用PrimeNG组件。所以我需要将primeng包作为DllBundlesPlugin中的供应商依赖,但是当我将'primeng'添加到供应商包中时,webpack编译失败并出现此错误:
DLL: Checking if DLLs are valid.
npm : { Error: Cannot find module 'primeng'
At line:1 char:1
+ npm run build:dev
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ({ Error: Cannot find module 'primeng':String)
[], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
at Function.Module._resolveFilename (module.js:470:15)
at Function.resolve (internal/module.js:27:19)
at DllBundlesControl.getPackageJsonPath
我的配置如下:
plugins: [
new DllBundlesPlugin({
bundles: {
polyfills: [
'core-js',
{
name: 'zone.js',
path: 'zone.js/dist/zone.js'
},
{
name: 'zone.js',
path: 'zone.js/dist/long-stack-trace-zone.js'
}
],
vendor: [
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/core',
'@angular/common',
'@angular/forms',
'@angular/http',
'@angular/router',
'primeng',
'rxjs',
]
},
dllDir: './wwwroot/dist',
webpackConfig: webpackMerge(commonConfig, {
devtool: 'cheap-module-source-map',
plugins: []
})
})
]
我也试过'primeng / primeng',但后来我得到了:
Error: Package name mismatch, Expected primeng/primeng but found primeng
那么,是否有可能以某种方式将DllBundlesPlugin与PrimeNG一起使用?