Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
110 lines (106 loc) · 2.67 KB
/
Copy pathwebpack.config.js
File metadata and controls
110 lines (106 loc) · 2.67 KB
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
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const { ClickBaseManager } = require('click-base-manager');
// var OpenBrowserPlugin = require('open-browser-webpack-plugin');
var CLICK_CONFIG = require('./click.config.js');
const extractCSS = new ExtractTextPlugin({ filename: 'css.bundle.css' });
// var CleanWebpackPlugin = require('clean-webpack-plugin');
// const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
// const MinifyPlugin = require('babel-minify-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/app.js',
devServer: {
historyApiFallback:true,
stats: 'minimal',
port: 8008
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: './app.js',
},
module: {
rules: [
{
test: /\.cl$/,
use:[
{
loader:'click-loader',
options: {...CLICK_CONFIG , env:'.cl'}
}
]
},
{
test: /\.js$/,
use:[
{
loader:'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
require('@babel/plugin-proposal-object-rest-spread'),
"@babel/plugin-syntax-dynamic-import"
]
}
},
{
loader:'click-loader',
options:{...CLICK_CONFIG , env:'.js'}
}
]
},
{
test: /\.css$/,
use: extractCSS.extract({ // Instance 1
fallback: 'style-loader',
use: [ 'css-loader' , 'click-style-loader' ]
})
},
{
test: /\.(jpg|jpeg|png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
},
{
test:/\.html$/,
use:['html-loader']
},
{
test:/\.html$/,
use:[
{
loader:'file-loader',
options:{
name:'[name].[ext]',
}
}
],
exclude:path.resolve(__dirname,'./src/index.html')
},
{
test:/\.(jpg|png)$/,
use:[
{
loader:'file-loader',
options:{
name:'[name].[ext]',
outputPath:'img/',
publicPath:'img/'
}
}
]
}
]
},
plugins:[
new HtmlWebpackPlugin({
template:'./src/index.html',
}),
new ClickBaseManager({
baseHref: process.env['npm_lifecycle_event'] == 'click' ? '/' : './',
configchain:CLICK_CONFIG
}),
// new OpenBrowserPlugin({ url: 'http://localhost:8008' }),
extractCSS,
]
};