Skip to content

Commit e8388ce

Browse files
author
Emanuel Kluge
committed
initial commit
0 parents  commit e8388ce

13 files changed

+922
-0
lines changed

Diff for: .github/workflows/ci.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checking out the branch
15+
uses: actions/checkout@v2
16+
17+
- name: Use Node.js 14
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: '14.x'
21+
22+
- name: Get yarn cache directory path
23+
id: yarn-cache-dir-path
24+
run: echo "::set-output name=dir::$(yarn cache dir)"
25+
26+
- name: Cache dependencies
27+
uses: actions/cache@v2
28+
with:
29+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
30+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-${{ matrix.node-version }}-
33+
${{ runner.os }}-node-
34+
${{ runner.os }}-
35+
36+
- name: Test
37+
run: |
38+
yarn build
39+
yarn test

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

Diff for: .nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

Diff for: .prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
trailingComma: es5
2+
jsxBracketSameLine: true
3+
singleQuote: true
4+
arrowParens: always

Diff for: README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# `can-webpack-prefetch-already`
2+
3+
> Waiting for webpack to do a CJS export from the output file while there's a dynamic import with the magic comment `/* webpackPrefetch: true */` in the code.
4+
5+
[![Repo build status](https://github.com/xing/can-webpack-prefetch-already/workflows/CI/badge.svg)](https://github.com/xing/can-webpack-prefetch-already/actions)

Diff for: package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "can-webpack-prefetch-already",
3+
"private": true,
4+
"scripts": {
5+
"build": "webpack",
6+
"test": "node test.js"
7+
},
8+
"devDependencies": {
9+
"prettier": "2.3.0"
10+
},
11+
"dependencies": {
12+
"webpack": "5.39.0",
13+
"webpack-cli": "4.7.0"
14+
}
15+
}

Diff for: renovate.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": ["config:base"],
3+
"automerge": true
4+
}

Diff for: src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = async () => {
2+
const { hello } = await import(/* webpackPrefetch: true */ './text');
3+
4+
console.log(hello());
5+
};

Diff for: src/text.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const hello = () => 'webpack does prefetch! :celebrate:';

Diff for: test.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const fn = require('./dist/main');
2+
3+
(async () => {
4+
await fn();
5+
})().catch((error) => {
6+
console.error(error);
7+
process.exit(1);
8+
});

Diff for: webpack.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
mode: 'development',
3+
target: 'async-node',
4+
output: {
5+
library: {
6+
type: 'commonjs2',
7+
},
8+
},
9+
devtool: false,
10+
};

0 commit comments

Comments
 (0)