-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
112 lines (109 loc) · 2.87 KB
/
webpack.config.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
const marked = require("marked");
const hlt = require("highlight.js")
const renderer = new marked.Renderer();
module.exports = {
entry: {
index: "./src/index.ts",
example: "./example/test.ts"
},
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
ignored: /node_modules/
},
devServer: {
historyApiFallback: true,
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000
},
devtool: '#source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
library: "compute",
libraryTarget: "umd",
},
resolve: {
extensions: [".ts", ".js", ".tsx", ".vue", ".md"],
alias: {
'vue$': 'vue/dist/vue.esm.js', // 用 webpack 1 时需用 'vue/dist/vue.common.js'
"@": path.resolve(__dirname, 'example/')
}
},
module: {
rules: [
{ test: /\.vue$/, loader: 'vue-loader',
options: {
loaders: {
ts: 'ts-loader',
tsx: 'babel-loader!ts-loader'
}
}
},
{ test: /\.ts$/, loader: 'ts-loader', options: { appendTsSuffixTo: [/(TS\.vue|\.vue)$/] } },
{ test: /\.tsx$/, loader: 'babel-loader!ts-loader', options: { appendTsxSuffixTo: [/(TSX\.vue|\.vue)$/] } },
{ test: /\.css$/, use: ['vue-style-loader','css-loader']},
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader@^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
{
test: /\.md$/,
use: [
"html-loader",
{
loader: "markdown-loader",
options: {
/* your options here */
pedantic: true,
renderer,
highlight (code) {
return hlt.highlightAuto(code).value;
},
gfm: true,
breaks: false,
sanitize: false,
smartLists: true,
smartypants: false,
xhtml: false
}
}
]
},
]
},
plugins: [
new VueLoaderPlugin(),
new webpack.WatchIgnorePlugin([
/\.js$/,
/\.d\.ts$/
]),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Development',
template: './example/index.html'
}),
new VuetifyLoaderPlugin()
]
}