我有一个 Angular2 (4.0.0-rc.2) 应用程序,其 Webpack 配置为使用 HMR 功能,我也使用 webpack-dll-bundles-plugin 在开发环境中制作 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 一起使用?