-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwebpack.common.js
66 lines (64 loc) · 1.76 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
const path = require('path')
const pkg = require('./package.json')
const assets = path.join(__dirname, 'assets')
const src = path.join(__dirname, 'src')
const lib = path.join(__dirname, 'lib')
module.exports = {
entry: {
shell: [`${assets}/style/main.scss`, `${src}/index.ts`],
},
output: {
path: lib,
filename: `[name].js`,
library: 'Shell',
libraryTarget: 'umd',
umdNamedDefine: true,
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
},
},
],
exclude: /node_modules/,
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
name: `${assets}/fonts/[name].[ext]`,
},
},
},
],
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
postcss: [autoprefixer()],
},
}),
new (require('webpack').BannerPlugin)(`${pkg.name} - ${pkg.description}
Author: ${pkg.author}
Version: v${pkg.version}
License: ${pkg.license}
Homepage: ${pkg.homepage}`),
],
resolve: {
extensions: ['.ts', '.js'],
},
}