Aurelia 1.x Q&A - Sandbox at https://codesandbox.io/s/aurelia-javascript-sandbox-jnl6q85zq5
Everything is an application-level singleton except for those things which are classified as "components", essentially custom elements, custom attributes and view-models created through the router or composition engine. You can change the lifetime of router and composition created components through explicit configuration.
I'm trying to split my CLI app into multiple bundles (different bundle for each major area of the app). I can't add bundle-specific dependencies without creating errors. They work fine if i put them in the vendor-bundle, but no other bundle. Is this is a known limitation?
"bundles": [
{
"name": "vendor-bundle.js",
"dependencies": [
// putting this dependency in vendor-bundle works:
{
"name": "chart.js",
"path": "../node_modules/chart.js/dist",
"main": "Chart.min.js"
}
]
},
{
"name": "foo-bundle.js",
"source": [
"[**/ux/foo/*.js]",
"**/ux/foo/*.{css,html}"
],
"dependencies": [
// putting dependency here results in error:
{
"name": "chart.js",
"path": "../node_modules/chart.js/dist",
"main": "Chart.min.js"
}
]
},
{
"name": "app-bundle.js",
"source":{
"include":[ "[**/*.js]", "**/*.{css,html}" ],
"exclude": [ "[**/ux/foo/*.js]", "**/ux/foo/*.{css,html}" ]
}
}
]
Errors:
TypeError: h.load is not a function
ERROR [app-router] Error: Load timeout for modules: template-registry-entry!ux/foo/index.html,text!ux/foo/index.html
Any ideas? Thanks.
"bundles": [
{
"name": "common-bundle.js",
"source": {
"include": ["**/*.{js,css,html}"],
"exclude": [
"**/app/**/*.{js,css,html}",
"**/admin/**/*.{js,css,html}"
]
}
},
{
"name": "app-bundle.js",
"source": ["**/app/**/*.{js,css,html}"]
},
{
"name": "admin-bundle.js",
"source": ["**/admin/**/*.{js,css,html}"],
"dependencies": [
{
"name": "@progress/kendo-ui",
"path": "../node_modules/@progress/kendo-ui/",
"resources": ["js/kendo.grid.js"]
}
]
},
{
"name": "vendor-bundle.js",
"prepend": ["node_modules/requirejs/require.js"],
"dependencies": [
"jquery",
{
"name": "bootstrap",
"path": "../node_modules/bootstrap/dist",
"main": "js/bootstrap.bundle.min",
"deps": ["jquery"],
"exports": "$",
"resources": ["css/bootstrap.css"]
},
"aurelia-bootstrapper",
"aurelia-loader-default",
"aurelia-pal-browser",
{
"name": "aurelia-testing",
"env": "dev"
},
"text"
]
}
],
conservativeCollapse: true
to aurelia_project/tasks/process_markup.js. See: http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace
Practical question:
The webpack.config.js code for exposing the Bluebird promise library in my (Aurelia) webapp is as follows:
module.exports = {
module: {
rules: [
{
test: /[\/\\]node_modules[\/\\]bluebird[\/\\].+\.js$/,
loader: 'expose-loader?Promise'
},
],
},
};
After updating webpack expose-loader to v1.0. I get this error in the browser console:
Error: Module build failed (from
./node_modules/expose-loader/dist/cjs.js): ValidationError: Invalid
options object. Expose Loader has been initialized using an options
object that does not match the API schema.options misses the property 'exposes'. Should be: non-empty string |
object { globalName, moduleLocalName?, override? } | [non-empty string
| object { globalName, moduleLocalName?, override? }, ...] (should not
have fewer than 1 item)
It's not obvious to me how to change the config at this point. Any suggestions? Many thanks!
My project gets stuck while npm install
on a jenkins build server in 3/4 times. Locally it builds fine. While I know this issue can be caused by endless reasons it is the only project that uses Aurelia CLI.
When I run npm install --verbose
I don't see anything specific - just that it gets stuck at no specific timeout or package (package varies from build to build)
Are there any known issues with Aurelia CLI on build servers? Should it be installed globally?
My project gets stuck while
npm install
on a jenkins build server in 3/4 times. Locally it builds fine. While I know this issue can be caused by endless reasons it is the only project that uses Aurelia CLI.
When I runnpm install --verbose
I don't see anything specific - just that it gets stuck at no specific timeout or package (package varies from build to build)Are there any known issues with Aurelia CLI on build servers? Should it be installed globally?
It was a problem with node dependencies. I replaced npm i
with npm ci
which I discovered today and it works perfectly.