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

174 lines
3.2 KiB
JavaScript
Raw Normal View History

2017-06-02 20:22:42 +08:00
var webpack = require("../../../../");
var path = require("path");
/** @type {function(any, any): import("../../../../").Configuration[]} */
module.exports = (env, { testPath }) => [
2017-06-02 20:22:42 +08:00
{
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/commonjs.js")
2017-06-02 20:22:42 +08:00
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("commonjs")
})
]
},
{
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/umd.js")
2017-06-02 20:22:42 +08:00
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("umd")
})
]
},
{
2020-02-26 18:00:47 +08:00
entry: "./this-test.js",
2017-06-02 20:22:42 +08:00
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/this.js")
2017-06-02 20:22:42 +08:00
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("this")
})
]
},
2020-02-26 18:00:47 +08:00
{
entry: "./var-test.js",
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/var.js")
2020-02-26 18:00:47 +08:00
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("var")
})
]
},
2017-06-02 20:22:42 +08:00
{
resolve: {
alias: {
2018-02-25 09:00:20 +08:00
library: path.resolve(
testPath,
"../0-create-library/commonjs2-external.js"
2018-02-25 09:00:20 +08:00
),
2017-06-02 20:22:42 +08:00
external: path.resolve(__dirname, "node_modules/external.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("commonjs2 with external"),
TEST_EXTERNAL: true
})
]
},
{
resolve: {
alias: {
library: path.resolve(
testPath,
"../0-create-library/commonjs2-external-eval.js"
),
external: path.resolve(__dirname, "node_modules/external.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("commonjs2 with external and eval devtool"),
TEST_EXTERNAL: true
})
]
},
{
resolve: {
alias: {
library: path.resolve(
testPath,
"../0-create-library/commonjs2-external-eval-source-map.js"
),
external: path.resolve(__dirname, "node_modules/external.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify(
"commonjs2 with external and eval-source-map devtool"
),
TEST_EXTERNAL: true
})
]
},
{
resolve: {
alias: {
library: path.resolve(
testPath,
"../0-create-library/commonjs2-split-chunks/"
),
external: path.resolve(__dirname, "node_modules/external.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("commonjs2 with splitChunks")
})
]
},
{
entry: "./default-test.js",
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/umd-default.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("default")
})
]
},
{
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/entryA.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("entryA")
})
]
},
{
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/entryB.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("entryB")
})
]
},
{
resolve: {
alias: {
library: path.resolve(testPath, "../0-create-library/entryC.js")
}
},
plugins: [
new webpack.DefinePlugin({
NAME: JSON.stringify("entryC")
})
]
}
2017-06-02 20:22:42 +08:00
];