FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
comical-js/webpack.common.js at master · BloomBooks/comical-js · GitHub
BloomBooks
comical-js
Repository navigation
Code
Issues
13
(13)
Pull requests
14
(14)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
comical-js
/
webpack.common.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
98 lines (92 loc) · 3.38 KB
Breadcrumbs
comical-js
/
webpack.common.js
Copy path
File metadata and controls
98 lines (92 loc) · 3.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var
path
=
require
(
"path"
)
;
var
webpack
=
require
(
"webpack"
)
;
var
node_modules
=
path
.
resolve
(
__dirname
,
"node_modules"
)
;
var
globule
=
require
(
"globule"
)
;
const
CopyPlugin
=
require
(
"copy-webpack-plugin"
)
;
var
outputDir
=
"dist"
;
// From Bloom's webpack, it seems this is needed
// if ever our output directory does not have the same parent as our node_modules. We then
// need to resolve the babel related presets (and plugins). This mapping function was
// suggested at https://github.com/babel/babel-loader/issues/166.
// Since our node_modules DOES have the same parent, maybe we could do without it?
function
localResolve
(
preset
)
{
return
Array
.
isArray
(
preset
)
?
[
require
.
resolve
(
preset
[
0
]
)
,
preset
[
1
]
]
:
require
.
resolve
(
preset
)
;
}
module
.
exports
=
{
// mode must be set to either "production" or "development" in webpack 4.
// Webpack-common is intended to be 'required' by something that provides that.
context
:
__dirname
,
entry
:
{
index
:
"./src/index.ts"
}
,
output
:
{
path
:
path
.
join
(
__dirname
,
outputDir
)
,
filename
:
"[name].js"
,
library
:
"ComicalJS"
,
// Exporting the library in umd format allows its various classes to
// be imported in typescript using import (rather than only by
// using require on the whole library) in a way that is consistent
// with the d.ts files we are generating. Using various other formats
// we found that a client could import the classes apparently successfully,
// but they were undefined at runtime.
// UMD is also a good universal library format that supports both AMD and commonjs.
libraryTarget
:
"umd"
}
,
resolve
:
{
modules
:
[
"."
,
node_modules
]
,
extensions
:
[
".js"
,
".jsx"
,
".ts"
,
".tsx"
]
}
,
optimization
:
{
minimize
:
false
,
splitChunks
:
{
cacheGroups
:
{
default
:
false
}
}
}
,
module
:
{
rules
:
[
{
test
:
/
\.
t
s
(
x
?
)
$
/
,
use
:
[
{
loader
:
"ts-loader"
}
]
}
,
{
test
:
/
\.
l
e
s
s
$
/
i
,
use
:
[
{
loader
:
"style-loader"
// creates style nodes from JS strings
}
,
{
loader
:
"css-loader"
// translates CSS into CommonJS
}
,
{
loader
:
"less-loader"
// compiles Less to CSS
}
]
}
,
{
test
:
/
\.
c
s
s
$
/
,
loader
:
"style-loader!css-loader"
}
,
// WOFF Font--needed?
{
test
:
/
\.
w
o
f
f
(
\?
v
=
\d
+
\.
\d
+
\.
\d
+
)
?
$
/
,
use
:
{
loader
:
"url-loader"
,
options
:
{
limit
:
10000
,
mimetype
:
"application/font-woff"
}
}
}
,
{
// this allows things like background-image: url("myComponentsButton.svg") and have the resulting path look for the svg in the stylesheet's folder
// the last few seem to be needed for (at least) slick-carousel to build.
test
:
/
\.
(
s
v
g
|
j
p
g
|
p
n
g
|
t
t
f
|
e
o
t
|
g
i
f
)
$
/
,
use
:
{
loader
:
"file-loader"
}
}
]
}
}
;
Back
|
FazBrowse Home
|
New Git URL