-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dll & dll-reference plugin examples
- Loading branch information
谢奇璇
committed
Nov 13, 2024
1 parent
bfae810
commit a73930c
Showing
11 changed files
with
329 additions
and
43 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import a from '../dll/a'; | ||
import alpha from '../dll/alpha'; | ||
import beta from 'beta/beta' | ||
import b from 'beta/b' | ||
import c from 'beta/c' | ||
|
||
|
||
console.log(a) | ||
console.log(alpha) | ||
console.log(beta) | ||
console.log(b) | ||
console.log(c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "example-dll-reference-plugin", | ||
"private": true, | ||
"scripts": { | ||
"dev": "rspack serve", | ||
"build": "rspack build || echo 'make-ci-happy'" | ||
}, | ||
"devDependencies": { | ||
"@rspack/cli": "1.1.1", | ||
"@rspack/core": "1.1.1", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
const rspack = require('@rspack/core') | ||
const path = require('node:path'); | ||
|
||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
entry: './index', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
}, | ||
resolve: { | ||
extensions: ['...', '.ts', '.tsx', '.js', '.jsx'] | ||
}, | ||
plugins: [ | ||
new rspack.DllReferencePlugin({ | ||
manifest: path.resolve(__dirname, '../dll/dist/alpha.manifest.json'), | ||
extensions: ['.js', '.ts'], | ||
}), | ||
new rspack.DllReferencePlugin({ | ||
manifest: path.resolve(__dirname, '../dll/dist/beta.manifest.json'), | ||
scope: 'beta', | ||
extensions: [".js", ".jsx", '.ts', '.tsx'] | ||
}), | ||
], | ||
mode: 'development' | ||
} | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "a"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "alpha"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "b"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "beta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "c.tsx"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "example-dll-plugin", | ||
"private": true, | ||
"scripts": { | ||
"dev": "rspack serve", | ||
"build": "rspack build || echo 'make-ci-happy'" | ||
}, | ||
"devDependencies": { | ||
"@rspack/cli": "1.1.1", | ||
"@rspack/core": "1.1.1", | ||
"typescript": "^5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
const rspack = require('@rspack/core') | ||
const path = require('node:path'); | ||
|
||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
resolve: { | ||
extensions: ['...', '.ts', '.tsx', '.js', '.jsx'], | ||
}, | ||
entry: { | ||
alpha: ["./alpha", "./a"], | ||
beta: ["./beta", "./b", "./c"], | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].dll.js', | ||
library: '[name]_dll_lib' | ||
}, | ||
plugins: [ | ||
new rspack.DllPlugin({ | ||
path: path.join(__dirname, "dist", "[name].manifest.json"), | ||
name: '[name]_dll_lib', | ||
}) | ||
] | ||
} | ||
|
||
module.exports = config; |