Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
50889179
Commit
50889179
authored
Mar 02, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjust webpack config
parent
a6c6e29c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
37 deletions
+40
-37
config/karma.config.js
config/karma.config.js
+8
-13
config/webpack.config.js
config/webpack.config.js
+32
-24
No files found.
config/karma.config.js
View file @
50889179
...
...
@@ -12,16 +12,14 @@ function fatalError(message) {
process
.
exit
(
1
);
}
// remove problematic plugins
if
(
webpackConfig
.
plugins
)
{
webpackConfig
.
plugins
=
webpackConfig
.
plugins
.
filter
(
function
(
plugin
)
{
return
!
(
plugin
instanceof
webpack
.
optimize
.
CommonsChunkPlugin
||
plugin
instanceof
webpack
.
optimize
.
ModuleConcatenationPlugin
||
plugin
instanceof
webpack
.
DefinePlugin
);
});
}
// disable problematic options
webpackConfig
.
entry
=
undefined
;
webpackConfig
.
mode
=
'
development
'
;
webpackConfig
.
optimization
.
runtimeChunk
=
false
;
webpackConfig
.
optimization
.
splitChunks
=
false
;
// use quicker sourcemap option
webpackConfig
.
devtool
=
'
cheap-inline-source-map
'
;
const
specFilters
=
argumentsParser
.
option
(
...
...
@@ -77,9 +75,6 @@ if (specFilters.length) {
);
}
webpackConfig
.
entry
=
undefined
;
webpackConfig
.
devtool
=
'
cheap-inline-source-map
'
;
// Karma configuration
module
.
exports
=
function
(
config
)
{
process
.
env
.
TZ
=
'
Etc/UTC
'
;
...
...
config/webpack.config.js
View file @
50889179
...
...
@@ -21,6 +21,7 @@ const NO_COMPRESSION = process.env.NO_COMPRESSION;
let
autoEntriesCount
=
0
;
let
watchAutoEntries
=
[];
const
defaultEntries
=
[
'
./webpack
'
,
'
./commons
'
,
'
./main
'
];
function
generateEntries
()
{
// generate automatic entry points
...
...
@@ -33,7 +34,7 @@ function generateEntries() {
function
generateAutoEntries
(
path
,
prefix
=
'
.
'
)
{
const
chunkPath
=
path
.
replace
(
/
\/
index
\.
js$/
,
''
);
const
chunkName
=
chunkPath
.
replace
(
/
\/
/g
,
'
.
'
);
autoEntries
[
chunkName
]
=
`
${
prefix
}
/
${
path
}
`
;
autoEntries
[
chunkName
]
=
defaultEntries
.
concat
(
`
${
prefix
}
/
${
path
}
`
)
;
}
pageEntries
.
forEach
(
path
=>
generateAutoEntries
(
path
));
...
...
@@ -41,10 +42,7 @@ function generateEntries() {
autoEntriesCount
=
Object
.
keys
(
autoEntries
).
length
;
const
manualEntries
=
{
common
:
'
./commons/index.js
'
,
main
:
'
./main.js
'
,
raven
:
'
./raven/index.js
'
,
webpack_runtime
:
'
./webpack.js
'
,
ide
:
'
./ide/index.js
'
,
};
...
...
@@ -52,6 +50,8 @@ function generateEntries() {
}
const
config
=
{
mode
:
IS_PRODUCTION
?
'
production
'
:
'
development
'
,
context
:
path
.
join
(
ROOT_PATH
,
'
app/assets/javascripts
'
),
entry
:
generateEntries
,
...
...
@@ -63,6 +63,33 @@ const config = {
chunkFilename
:
IS_PRODUCTION
?
'
[name].[chunkhash].chunk.js
'
:
'
[name].chunk.js
'
,
},
optimization
:
{
nodeEnv
:
false
,
runtimeChunk
:
'
single
'
,
splitChunks
:
{
maxInitialRequests
:
4
,
cacheGroups
:
{
default
:
false
,
common
:
()
=>
({
priority
:
20
,
name
:
'
main
'
,
chunks
:
'
initial
'
,
minChunks
:
autoEntriesCount
*
0.9
,
}),
vendors
:
{
priority
:
10
,
chunks
:
'
async
'
,
test
:
/
[\\/](
node_modules|vendor
[\\/]
assets
[\\/]
javascripts
)[\\/]
/
,
},
commons
:
{
chunks
:
'
all
'
,
minChunks
:
2
,
reuseExistingChunk
:
true
,
},
},
},
},
module
:
{
rules
:
[
{
...
...
@@ -209,11 +236,6 @@ const config = {
return
`
${
moduleNames
[
0
]}
-
${
hash
.
substr
(
0
,
6
)}
`
;
}),
// create cacheable common library bundles
new
webpack
.
optimize
.
CommonsChunkPlugin
({
names
:
[
'
main
'
,
'
common
'
,
'
webpack_runtime
'
],
}),
// copy pre-compiled vendor libraries verbatim
new
CopyWebpackPlugin
([
{
...
...
@@ -260,20 +282,6 @@ const config = {
if
(
IS_PRODUCTION
)
{
config
.
devtool
=
'
source-map
'
;
config
.
plugins
.
push
(
new
webpack
.
NoEmitOnErrorsPlugin
(),
new
webpack
.
LoaderOptionsPlugin
({
minimize
:
true
,
debug
:
false
,
}),
new
webpack
.
optimize
.
ModuleConcatenationPlugin
(),
new
webpack
.
optimize
.
UglifyJsPlugin
({
sourceMap
:
true
,
}),
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
'
production
'
)
},
})
);
// compression can require a lot of compute time and is disabled in CI
if
(
!
NO_COMPRESSION
)
{
...
...
@@ -294,7 +302,7 @@ if (IS_DEV_SERVER) {
};
config
.
plugins
.
push
(
// watch node_modules for changes if we encounter a missing module compile error
new
WatchMissingNodeModulesPlugin
(
path
.
join
(
ROOT_PATH
,
'
node_modules
'
)),
//
new WatchMissingNodeModulesPlugin(path.join(ROOT_PATH, 'node_modules')),
// watch for changes to our automatic entry point modules
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment