Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
dc867bad
Commit
dc867bad
authored
6 years ago
by
netpro2k
Browse files
Options
Downloads
Patches
Plain Diff
Revert merge issue with webpack.config.js
parent
40435169
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webpack.config.js
+33
-38
33 additions, 38 deletions
webpack.config.js
with
33 additions
and
38 deletions
webpack.config.js
+
33
−
38
View file @
dc867bad
...
...
@@ -9,7 +9,6 @@ const HTMLWebpackPlugin = require("html-webpack-plugin");
const
ExtractTextPlugin
=
require
(
"
extract-text-webpack-plugin
"
);
const
CopyWebpackPlugin
=
require
(
"
copy-webpack-plugin
"
);
const
UglifyJsPlugin
=
require
(
"
uglifyjs-webpack-plugin
"
);
const
_
=
require
(
"
lodash
"
);
function
createHTTPSConfig
()
{
// Generate certs for the local webpack-dev-server.
...
...
@@ -58,21 +57,6 @@ function createHTTPSConfig() {
}
}
class
LodashTemplatePlugin
{
constructor
(
options
)
{
this
.
options
=
options
;
}
apply
(
compiler
)
{
compiler
.
plugin
(
"
compilation
"
,
compilation
=>
{
compilation
.
plugin
(
"
html-webpack-plugin-before-html-processing
"
,
async
data
=>
{
data
.
html
=
_
.
template
(
data
.
html
,
this
.
options
)();
return
data
;
});
});
}
}
module
.
exports
=
(
env
,
argv
)
=>
({
entry
:
{
index
:
path
.
join
(
__dirname
,
"
src
"
,
"
index.js
"
),
...
...
@@ -118,9 +102,7 @@ module.exports = (env, argv) => ({
loader
:
"
html-loader
"
,
options
:
{
// <a-asset-item>'s src property is overwritten with the correct transformed asset url.
attrs
:
[
"
img:src
"
,
"
a-asset-item:src
"
,
"
audio:src
"
,
"
source:src
"
],
// You can get transformed asset urls in an html template using ${require("pathToFile.ext")}
interpolate
:
"
require
"
attrs
:
[
"
img:src
"
,
"
a-asset-item:src
"
,
"
audio:src
"
,
"
source:src
"
]
}
},
{
...
...
@@ -187,33 +169,57 @@ module.exports = (env, argv) => ({
}
]
},
// necessary due to https://github.com/visionmedia/debug/issues/547
optimization
:
{
minimizer
:
[
new
UglifyJsPlugin
({
uglifyOptions
:
{
compress
:
{
collapse_vars
:
false
}
}
})]
// necessary due to https://github.com/visionmedia/debug/issues/547
minimizer
:
[
new
UglifyJsPlugin
({
uglifyOptions
:
{
compress
:
{
collapse_vars
:
false
}
}
})],
splitChunks
:
{
cacheGroups
:
{
engine
:
{
test
:
/
[\\/]
node_modules
[\\/](
aframe|cannon|three
\.
js
)
/
,
priority
:
100
,
name
:
"
engine
"
,
chunks
:
"
all
"
},
vendors
:
{
test
:
/
([\\/]
node_modules
[\\/]
|
[\\/]
vendor
[\\/])
/
,
priority
:
50
,
name
:
"
vendor
"
,
chunks
:
"
all
"
}
}
}
},
plugins
:
[
// Each output page needs a HTMLWebpackPlugin entry
new
HTMLWebpackPlugin
({
filename
:
"
index.html
"
,
template
:
path
.
join
(
__dirname
,
"
src
"
,
"
index.html
"
),
// Chunks correspond with the entries you wish to include in your html template
chunks
:
[
"
index
"
]
chunks
:
[
"
vendor
"
,
"
index
"
]
}),
new
HTMLWebpackPlugin
({
filename
:
"
hub.html
"
,
template
:
path
.
join
(
__dirname
,
"
src
"
,
"
hub.html
"
),
chunks
:
[
"
hub
"
],
inject
:
"
head
"
chunks
:
[
"
vendor
"
,
"
engine
"
,
"
hub
"
],
inject
:
"
head
"
,
meta
:
[
{
"
http-equiv
"
:
"
origin-trial
"
,
"
data-feature
"
:
"
WebVR (For Chrome M62+)
"
,
"
data-expires
"
:
process
.
env
.
ORIGIN_TRIAL_EXPIRES
,
content
:
process
.
env
.
ORIGIN_TRIAL_TOKEN
}
]
}),
new
HTMLWebpackPlugin
({
filename
:
"
link.html
"
,
template
:
path
.
join
(
__dirname
,
"
src
"
,
"
link.html
"
),
chunks
:
[
"
link
"
]
chunks
:
[
"
vendor
"
,
"
link
"
]
}),
new
HTMLWebpackPlugin
({
filename
:
"
avatar-selector.html
"
,
template
:
path
.
join
(
__dirname
,
"
src
"
,
"
avatar-selector.html
"
),
chunks
:
[
"
avatar-selector
"
],
chunks
:
[
"
vendor
"
,
"
engine
"
,
"
avatar-selector
"
],
inject
:
"
head
"
}),
new
CopyWebpackPlugin
([
...
...
@@ -233,17 +239,6 @@ module.exports = (env, argv) => ({
filename
:
"
assets/stylesheets/[name]-[md5:contenthash:hex:20].css
"
,
disable
:
argv
.
mode
!==
"
production
"
}),
// Transform the output of the html-loader using _.template
// before passing the result to html-webpack-plugin
new
LodashTemplatePlugin
({
// expose these variables to the lodash template
// ex: <%= ORIGIN_TRIAL_TOKEN %>
imports
:
{
NODE_ENV
:
argv
.
mode
,
ORIGIN_TRIAL_EXPIRES
:
process
.
env
.
ORIGIN_TRIAL_EXPIRES
,
ORIGIN_TRIAL_TOKEN
:
process
.
env
.
ORIGIN_TRIAL_TOKEN
}
}),
// Define process.env variables in the browser context.
new
webpack
.
DefinePlugin
({
"
process.env
"
:
JSON
.
stringify
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment