-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.gear-viewer.prod.js
86 lines (85 loc) · 1.74 KB
/
webpack.config.gear-viewer.prod.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
const path = require('path');
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/src/gear-viewer.html',
path: "dist-gear-viewer",
filename: 'index.html',
inject: 'body'
})
const CopyWebpackPlugin = require("copy-webpack-plugin");
const CopyWebpackPluginConfig = new CopyWebpackPlugin([{
from: "src/lib",
to: "lib"
}, {
from: "src/assets",
to: "assets"
}]);
module.exports = {
entry: ['./src/ts/gear-viewer.ts', './src/scss/main.scss'],
devtool: 'inline-source-map',
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}, {
test: /scss\/.*?\.scss$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].css',
outputPath: 'assets/css/'
}
},
{
loader: 'extract-loader'
},
{
loader: 'css-loader'
},
{
loader: 'postcss-loader'
},
{
loader: 'sass-loader'
}
],
exclude: [/node_modules/, /ts/]
}, {
test: /ts\/.*?\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
}, {
test: /\.vue?$/,
use: 'vue-loader',
exclude: /node_modules/
}]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['.tsx', '.ts', '.js', '.vue']
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist-gear-viewer')
},
plugins: [
HTMLWebpackPluginConfig,
CopyWebpackPluginConfig,
new VueLoaderPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new UglifyJSPlugin()
]
};