-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
142 lines (138 loc) · 4.61 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* eslint-disable */
/* global require module __dirname process */
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const ConfigWebpackPlugin = require("config-webpack");
// const Uglify = require('uglifyjs-webpack-plugin');
const extractSass = new ExtractTextPlugin({
filename: '[name].bundle.css',
allChunks: true
});
module.exports = {
entry: ['./src/DiffVisualizer.js', './src/sass/main.scss'],
output: {
path: path.join(__dirname, 'public/dist'),
filename: 'bundle.js'
},
devServer: {
contentBase: './public/'
},
module: {
loaders: [
// {
// test: /\.js$/,
// loader: 'babel-loader'
// },
// { // regular css files
// test: /\.css$/,
// loader: ExtractTextPlugin.extract({
// loader: 'css-loader?importLoaders=1'
// })
// },
{
test: /\.(sass|scss)$/,
loader: extractSass.extract([{
loader: 'css-loader',
options: process.env.NODE_ENV === 'production' ? {
minimize: true
} : {
minimize: false
}
}, {
loader: 'sass-loader'
}]),
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader'
}
]
},
plugins: [
new CopyWebpackPlugin([
// {output}/to/file.txt
//jquery
{
context: __dirname,
from: 'node_modules/jquery/dist/jquery.min.js',
to: 'jquery.min.js'
},
//bootstrap
{
context: __dirname,
from: 'node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js',
to: 'bootstrap.min.js'
},
//scrollTo jquery
{
context: __dirname,
from: 'node_modules/jquery.scrollto/jquery.scrollTo.min.js',
to: 'jquery.scrollTo.min.js'
},
//highlightjs
{
context: __dirname,
from: 'node_modules/highlightjs/highlight.pack.min.js',
to: 'highlight.pack.min.js'
},
//highlightjs line numbers
{
context: __dirname,
from: 'node_modules/highlightjs-line-numbers.js/dist/highlightjs-line-numbers.min.js',
to: 'highlightjs-line-numbers.min.js'
},
//bootstrap-toggle
{
context: __dirname,
from: 'node_modules/bootstrap-toggle/js/bootstrap2-toggle.min.js',
to: 'bootstrap2-toggle.min.js'
},
//mark.js
{
context: __dirname,
from: 'node_modules/mark.js/dist/jquery.mark.min.js',
to: 'jquery.mark.min.js'
},
//bootbox
{
context: __dirname,
from: 'node_modules/bootbox/bootbox.min.js',
to: 'bootbox.min.js'
},
// boostrap notify
{
context: __dirname,
from: 'node_modules/bootstrap-notify/bootstrap-notify.min.js',
to: 'bootstrap-notify.min.js'
},
// twitter-bootstrap-wizard
{
context: __dirname,
from: 'node_modules/twitter-bootstrap-wizard/jquery.bootstrap.wizard.min.js',
to: 'jquery.bootstrap.wizard.min.js'
},
//jquery.validate.min.js
{
context: __dirname,
from: 'node_modules/jquery-validation/dist/jquery.validate.min.js',
to: 'jquery.validate.min.js'
},
// monaco editor
// COMMENT OUT WHEN DEVELOPING, BIG PERFORMANCE HIT!
{
context: path.join(__dirname, 'node_modules/monaco-editor/'),
from: '**/*',
to: 'monaco-editor'
},
], {
// By default, we only copy modified files during
// a watch or webpack-dev-server build. Setting this
// to `true` copies all files.
copyUnmodified: false
}),
extractSass,
new ConfigWebpackPlugin()
// new Uglify()
]
};