Skip to content

Commit 569c966

Browse files
committed
modify webpack config
1 parent b8618af commit 569c966

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

webpack/webpack.common.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
const {resolve} = require('path');
2+
const CopyPlugin = require('copy-webpack-plugin');
3+
14
module.exports = {
2-
entry: './src/index.ts',
3-
output: {
4-
library:'Router',
5-
libraryTarget:'umd'
5+
entry: './src/index.ts',
6+
output: {
7+
library: 'Router',
8+
libraryTarget: 'umd',
69
},
710
resolve: {
8-
extensions: ['.tsx', '.ts', 'd.ts','.js', '.json'],
9-
},
11+
extensions: ['.tsx', '.ts', 'd.ts', '.js', '.json'],
12+
},
1013
module: {
1114
rules: [
1215
{
@@ -20,4 +23,13 @@ module.exports = {
2023
},
2124
],
2225
},
26+
plugins: [
27+
new CopyPlugin([
28+
{
29+
force: true,
30+
from: resolve(__dirname, '../src/component'),
31+
to: resolve(__dirname, '../dist'),
32+
},
33+
]),
34+
],
2335
};

webpack/webpack.dev.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
const {merge} = require("webpack-merge");
2-
const common = require("./webpack.common.js");
32
const {resolve} = require('path');
3+
const common = require("./webpack.common.js");
4+
const CopyPlugin = require('copy-webpack-plugin');
5+
6+
const output=resolve(__dirname, '../examples/uni-simple-router2.0/dist');
47

58
module.exports = merge(common, {
69
mode: 'development',
710
devtool: 'source-map',
811
output: {
9-
path: resolve(__dirname, '../examples/uni-simple-router2.0/dist'),
12+
path:output ,
1013
filename: 'uni-simple-router.js',
11-
},
14+
},
15+
plugins: [
16+
new CopyPlugin([{
17+
force: true,
18+
from: resolve(__dirname, '../src/component'),
19+
to: output,
20+
}]),
21+
]
1222
});

0 commit comments

Comments
 (0)