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
04bdbfd4
Commit
04bdbfd4
authored
Feb 13, 2020
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically create DLL when it does not exist
parent
e58b7bda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
12 deletions
+49
-12
config/webpack.config.js
config/webpack.config.js
+49
-12
No files found.
config/webpack.config.js
View file @
04bdbfd4
...
@@ -117,23 +117,18 @@ if (IS_EE) {
...
@@ -117,23 +117,18 @@ if (IS_EE) {
});
});
}
}
// if there is a compiled DLL with a matching hash string, use it
let
dll
;
let
dll
;
if
(
VENDOR_DLL
&&
!
IS_PRODUCTION
)
{
if
(
VENDOR_DLL
&&
!
IS_PRODUCTION
)
{
const
dllHash
=
vendorDllHash
();
const
dllHash
=
vendorDllHash
();
const
dllCachePath
=
path
.
join
(
ROOT_PATH
,
`tmp/cache/webpack-dlls/
${
dllHash
}
`
);
const
dllCachePath
=
path
.
join
(
ROOT_PATH
,
`tmp/cache/webpack-dlls/
${
dllHash
}
`
);
if
(
fs
.
existsSync
(
dllCachePath
))
{
dll
=
{
console
.
log
(
`Using vendor DLL found at:
${
dllCachePath
}
`
);
manifestPath
:
path
.
join
(
dllCachePath
,
'
vendor.dll.manifest.json
'
),
dll
=
{
cacheFrom
:
dllCachePath
,
manifestPath
:
path
.
join
(
dllCachePath
,
'
vendor.dll.manifest.json
'
),
cacheTo
:
path
.
join
(
ROOT_PATH
,
`public/assets/webpack/dll.
${
dllHash
}
/`
),
cacheFrom
:
dllCachePath
,
publicPath
:
`dll.
${
dllHash
}
/vendor.dll.bundle.js`
,
cacheTo
:
path
.
join
(
ROOT_PATH
,
`public/assets/webpack/dll.
${
dllHash
}
/`
),
exists
:
null
,
publicPath
:
`dll.
${
dllHash
}
/vendor.dll.bundle.js`
,
};
};
}
else
{
console
.
log
(
`Warning: No vendor DLL found at:
${
dllCachePath
}
. DllPlugin disabled.`
);
}
}
}
module
.
exports
=
{
module
.
exports
=
{
...
@@ -314,6 +309,48 @@ module.exports = {
...
@@ -314,6 +309,48 @@ module.exports = {
jQuery
:
'
jquery
'
,
jQuery
:
'
jquery
'
,
}),
}),
// if DLLs are enabled, detect whether the DLL exists and create it automatically if necessary
dll
&&
{
apply
(
compiler
)
{
compiler
.
hooks
.
beforeCompile
.
tapAsync
(
'
DllAutoCompilePlugin
'
,
(
params
,
callback
)
=>
{
if
(
dll
.
exists
)
{
callback
();
}
else
if
(
fs
.
existsSync
(
dll
.
manifestPath
))
{
console
.
log
(
`Using vendor DLL found at:
${
dll
.
cacheFrom
}
`
);
dll
.
exists
=
true
;
callback
();
}
else
{
console
.
log
(
`Warning: No vendor DLL found at:
${
dll
.
cacheFrom
}
. Compiling DLL automatically.`
,
);
const
dllConfig
=
require
(
'
./webpack.vendor.config.js
'
);
const
dllCompiler
=
webpack
(
dllConfig
);
dllCompiler
.
run
((
err
,
stats
)
=>
{
if
(
err
)
{
return
callback
(
err
);
}
const
info
=
stats
.
toJson
();
if
(
stats
.
hasErrors
())
{
console
.
error
(
info
.
errors
.
join
(
'
\n\n
'
));
}
if
(
stats
.
hasWarnings
())
{
console
.
warn
(
info
.
warnings
.
join
(
'
\n\n
'
));
}
console
.
log
(
'
DLL compiled successfully.
'
);
dll
.
exists
=
true
;
callback
();
});
}
});
},
},
// reference our compiled DLL modules
// reference our compiled DLL modules
dll
&&
dll
&&
new
webpack
.
DllReferencePlugin
({
new
webpack
.
DllReferencePlugin
({
...
...
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