Skip to content

Commit 04dcf41

Browse files
committed
setup async chunk imports
1 parent 9a431b8 commit 04dcf41

12 files changed

Lines changed: 319 additions & 31 deletions

.babelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
["@babel/env", {
44
"useBuiltIns": "usage",
55
"corejs": 3,
6-
"targets": "> 0.25%, not dead"
6+
"targets": "> 5.0%, not dead"
77
}],
88
"@babel/typescript"
99
],
1010
"plugins": [
11-
["@babel/plugin-proposal-decorators", {"legacy": true}],
12-
["@babel/proposal-class-properties", {"loose": true}],
11+
["@babel/plugin-proposal-decorators", {"decoratorsBeforeExport": true}],
12+
["@babel/proposal-class-properties"],
1313
"@babel/proposal-object-rest-spread"
1414
]
1515
}

.vscode/oriole.code-snippets

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
// Place your Oriole workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
// "Print to console": {
10+
// "scope": "javascript,typescript",
11+
// "prefix": "log",
12+
// "body": [
13+
// "console.log('$1');",
14+
// "$2"
15+
// ],
16+
// "description": "Log output to console"
17+
// }
18+
19+
"Component": {
20+
"scope": "typescript",
21+
"prefix": "component",
22+
"description": "Generate a bare bones Oriole component",
23+
"body": [
24+
"import { LitElement, css, html, customElement } from \"lit-element\";",
25+
"import { globalStyles } from \"../globalStyles\";",
26+
"",
27+
"@customElement('ori-${TM_FILENAME_BASE/(.*)\\..+$/${1:/lowercase}/}')",
28+
"export class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} extends LitElement {",
29+
"\t",
30+
"\trender() {",
31+
"\t\treturn html`<div class=\"${TM_FILENAME_BASE/(.*)\\..+$/${1:/lowercase}/}\">$0</div>`;",
32+
"\t}",
33+
"\t",
34+
"\tstatic get styles() {",
35+
"\t\treturn [",
36+
"\t\t\tglobalStyles,",
37+
"\t\t\tcss``",
38+
"\t\t];",
39+
"\t}",
40+
"}",
41+
""
42+
]
43+
}
44+
}

package-lock.json

Lines changed: 162 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"lit-element": "^2.4.0",
3636
"rollup": "^2.26.9",
3737
"rollup-plugin-copy": "^3.4.0",
38+
"rollup-plugin-delete": "^2.0.0",
3839
"rollup-plugin-dev": "^1.1.3",
3940
"rollup-plugin-minify-html-literals": "^1.2.6",
4041
"rollup-plugin-terser": "^7.0.2",

rollup.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import html from '@rollup/plugin-html';
77
import copy from 'rollup-plugin-copy';
88
import { indexHtml } from './src/indexHtml.js';
99
import dev from 'rollup-plugin-dev';
10+
import del from 'rollup-plugin-delete';
1011

1112
const extensions = ['.js', '.ts'];
1213

@@ -20,13 +21,14 @@ const config = {
2021
dir: 'dist',
2122
format: 'es',
2223
name: 'Oriole',
23-
entryFileNames: '[name]-[hash].js',
24-
chunkFileNames: '[name]-[hash].js',
24+
entryFileNames: '[name].[hash].js',
25+
chunkFileNames: '[hash].js',
2526
},
2627

2728
plugins: [
29+
del({ targets: 'dist/*' }),
2830
html({
29-
template: indexHtml,
31+
template: (opts) => indexHtml(opts, ['app.']),
3032
}),
3133
minifyHTML(),
3234
copy(copyConfig),
@@ -51,7 +53,7 @@ if (!isDevelopment) {
5153
config.plugins = [
5254
...config.plugins,
5355
terser({}),
54-
dev({ dirs: ['dist'], host: 'localhost', spa: true }),
56+
dev({ dirs: ['dist'], host: 'localhost', spa: 'dist/index.html' }),
5557
];
5658
}
5759

0 commit comments

Comments
 (0)