-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.ls
169 lines (158 loc) · 4.12 KB
/
webpack.config.ls
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
require! {
path
process
webpack
fs
}
cwd = process.cwd()
npmdir = (x) ->
path.join(cwd, 'node_modules', x)
npmdir_jspm = (x) ->
path.join(cwd, 'src', 'jspm_packages', 'npm', x)
npmdir_custom = (x) ->
path.join(cwd, 'src', 'modules_custom', x)
fromcwd = (x) ->
path.join(cwd, x)
webpack_config = {
#devtool: 'eval-cheap-module-source-map'
#devtool: 'cheap-module-source-map'
devtool: false
#devtool: 'linked-src'
#devtool: null
#debug: true
watch: false
plugins: [
# new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/)
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
# new webpack.optimize.DedupePlugin()
]
module: {
loaders: [
{
test: /\.html$/
loader: 'html-loader?attrs=false&minimize=true'
exclude: [
fromcwd('node_modules')
#fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
]
}
{
# asset loader
test: /\.(woff|woff2|ttf|eot)$/,
loader: 'file-loader?name=[path][name]'
exclude: [
fromcwd('node_modules')
fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
]
}
{
# image loader
test: /\.(jpe?g|png|gif|svg)$/i,
loader:'file-loader?name=[path][name]'
exclude: [
fromcwd('node_modules')
fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
]
}
{
# js loader
test: /\.js$/
loader: './webpack_habitlab_js_intervention_loader.js'
include: [fromcwd('src/interventions')]
exclude: [
fromcwd('node_modules')
fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
]
}
# {
# test: /\.ls$/
# # livescript with embedded jsx
# # need the linked-src option according to
# # https://github.com/appedemic/livescript-loader/issues/10
# loader: 'babel-loader!livescript-loader?map=linked-src'
# include: [fromcwd('src/components_skate')]
# exclude: [
# fromcwd('node_modules')
# fromcwd('bower_components')
# ]
# }
{
test: /\.ls$/
loader: './webpack_habitlab_ls_intervention_loader.js'
include: [fromcwd('src/interventions')]
exclude: [
fromcwd('node_modules')
fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
]
}
{
test: /\.ls$/
loader: 'livescript-async-loader'
include: [fromcwd('src')]
exclude: [
fromcwd('node_modules')
fromcwd('src/bower_components')
fromcwd('src/jspm_packages')
fromcwd('src/interventions')
]
}
{
test: /\.jsx$/
loader: 'babel-loader'
include: [fromcwd('src')]
exclude: [
fromcwd('node_modules')
fromcwd('bower_components')
]
options: {
presets: ['@babel/react'],
# plugins: [require('@babel/plugin-proposal-object-rest-spread')]
}
}
# {
# test: /\.jsx$/,
# exclude: /(node_modules|bower_components)/,
# use: {
# loader: 'babel-loader',
# options: {
# presets: ['@babel/preset-env']
#
# }
# }
# }
]
}
resolve: {
unsafeCache: true
modules: [
fromcwd('src')
'node_modules'
]
extensions: [
#''
# '.jsx'
'.ls'
'.js'
]
alias: {
}
}
node: {
fs: 'empty'
}
}
/*
for libname in fs.readdirSync 'src/jspm_packages/npm'
if libname.endsWith('.json')
continue
libname_base = libname.split('@')[0]
webpack_config.resolve.alias[libname_base] = npmdir_jspm libname
*/
for libname in fs.readdirSync 'src/modules_custom'
webpack_config.resolve.alias[libname] = npmdir_custom libname
module.exports = webpack_config