将 Aurelia CLI 与新的 webpack 选项一起使用,我将如何添加对 aurelia-auth 的引用
Using Aurelia CLI with the new webpack option, how would I add a reference to aurelia-auth
我使用最新的 aurelia-cli 设置了一个新的 Aurelia 项目。我选择使用 webpack 和 TypeScript。在使用 webpack 时将插件添加到项目中时,文档的方式似乎并不多。我想添加 aurelia-auth。我尝试将它添加到我的 package.json:
中的 aurelia 部分
"aurelia": {
"build": {
"resources": [
"aurelia-auth"
]
}
}
然后使用它:
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'))
.plugin(PLATFORM.moduleName('aurelia-auth'), (baseConfig)=>{
baseConfig.configure({});
});
但似乎并非所有内容都在:
Unhandled rejection Error: Unable to find module with ID:
aurelia-auth/auth-filter
使用 Aurelia CLI 和 webpack 捆绑和 运行 应用程序时添加引用的正确方法是什么?
对于 Webpack:
在 webpack.config.js
中,plugins
属性 中有一个 ModulesDependenciesPlugin
条目。在那里添加 aurelia-auth,例如:
new ModuleDependenciesPlugin({
'aurelia-testing': [ './compile-spy', './view-spy' ],
'aurelia-auth': [ './auth-filter' ]
}),
对于 RequireJS:
您应该将插件添加到 aurelia.json
的 build.bundles.dependencies
属性.
尝试以下操作:
"dependencies": [
...,
{
"name": "aurelia-auth",
"path": "../node_modules/aurelia-auth/dist/amd",
"main": "aurelia-auth"
}
]
我使用最新的 aurelia-cli 设置了一个新的 Aurelia 项目。我选择使用 webpack 和 TypeScript。在使用 webpack 时将插件添加到项目中时,文档的方式似乎并不多。我想添加 aurelia-auth。我尝试将它添加到我的 package.json:
中的 aurelia 部分 "aurelia": {
"build": {
"resources": [
"aurelia-auth"
]
}
}
然后使用它:
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'))
.plugin(PLATFORM.moduleName('aurelia-auth'), (baseConfig)=>{
baseConfig.configure({});
});
但似乎并非所有内容都在:
Unhandled rejection Error: Unable to find module with ID: aurelia-auth/auth-filter
使用 Aurelia CLI 和 webpack 捆绑和 运行 应用程序时添加引用的正确方法是什么?
对于 Webpack:
在 webpack.config.js
中,plugins
属性 中有一个 ModulesDependenciesPlugin
条目。在那里添加 aurelia-auth,例如:
new ModuleDependenciesPlugin({
'aurelia-testing': [ './compile-spy', './view-spy' ],
'aurelia-auth': [ './auth-filter' ]
}),
对于 RequireJS:
您应该将插件添加到 aurelia.json
的 build.bundles.dependencies
属性.
尝试以下操作:
"dependencies": [
...,
{
"name": "aurelia-auth",
"path": "../node_modules/aurelia-auth/dist/amd",
"main": "aurelia-auth"
}
]