-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.gear-viewer.js
95 lines (93 loc) · 1.87 KB
/
webpack.config.gear-viewer.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/src/gear-viewer.html',
path: "dist-gear-viewer",
filename: 'index.html',
inject: 'body'
})
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const BrowserSyncPluginConfig = new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
open: false,
proxy: 'http://localhost:8080/'
}, config = {
injectCss: true,
server: 'database',
reload: true
});
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')
},
mode: 'development',
devServer: {
open: false
},
plugins: [
HTMLWebpackPluginConfig,
BrowserSyncPluginConfig,
CopyWebpackPluginConfig,
new VueLoaderPlugin()
]
};