Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6b94a7

Browse files
committed
add module library test case
1 parent 82e78fc commit b6b94a7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

test/configCases/library/0-create-library/webpack.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ const path = require("path");
22
const webpack = require("../../../../");
33
/** @type {function(any, any): import("../../../../").Configuration[]} */
44
module.exports = (env, { testPath }) => [
5+
{
6+
output: {
7+
filename: "esm.js",
8+
libraryTarget: "module"
9+
},
10+
target: "node14",
11+
resolve: {
12+
alias: {
13+
external: "./non-external"
14+
}
15+
},
16+
experiments: {
17+
outputModule: true
18+
}
19+
},
520
{
621
output: {
722
filename: "commonjs.js",

test/configCases/library/1-use-library/webpack.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ var webpack = require("../../../../");
22
var path = require("path");
33
/** @type {function(any, any): import("../../../../").Configuration[]} */
44
module.exports = (env, { testPath }) => [
5+
{
6+
resolve: {
7+
alias: {
8+
library: path.resolve(testPath, "../0-create-library/esm.js")
9+
}
10+
},
11+
plugins: [
12+
new webpack.DefinePlugin({
13+
NAME: JSON.stringify("esm")
14+
})
15+
]
16+
},
517
{
618
resolve: {
719
alias: {

0 commit comments

Comments
 (0)