Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Frontend
Commits
cda2257c
Commit
cda2257c
authored
3 years ago
by
Bastien Abadie
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-production-build-css' into 'master'
Generate CSS files for production builds Closes
#951
See merge request
!1236
parents
bf3cb85b
eef61bb2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1236
Generate CSS files for production builds
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webpack.config.js
+42
-1
42 additions, 1 deletion
webpack.config.js
with
42 additions
and
1 deletion
webpack.config.js
+
42
−
1
View file @
cda2257c
const
path
=
require
(
'
path
'
)
const
webpack
=
require
(
'
webpack
'
)
const
{
merge
}
=
require
(
'
webpack-merge
'
)
const
{
merge
WithRules
}
=
require
(
'
webpack-merge
'
)
const
{
VueLoaderPlugin
}
=
require
(
'
vue-loader
'
)
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
)
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
)
...
...
@@ -151,6 +151,19 @@ const production = {
]
},
module
:
{
rules
:
[
{
test
:
/
\.(
sa|sc|c
)
ss$/
,
use
:
[
MiniCssExtractPlugin
.
loader
,
'
css-loader
'
,
'
sass-loader
'
]
}
]
},
plugins
:
[
// Remove previous build
new
CleanWebpackPlugin
(),
...
...
@@ -197,6 +210,19 @@ const surge = {
]
},
module
:
{
rules
:
[
{
test
:
/
\.(
sa|sc|c
)
ss$/
,
use
:
[
MiniCssExtractPlugin
.
loader
,
'
css-loader
'
,
'
sass-loader
'
]
}
]
},
plugins
:
[
new
webpack
.
EnvironmentPlugin
({
// Use API Url provided by environment on surge
...
...
@@ -215,6 +241,21 @@ const surge = {
]
}
/**
* Custom webpack merging that allows overriding a single rule
* without overriding all of module.rules.
* The correct rule to update will be matched using its `test` field
* and the `use` field will be replaced by whatever is set in the overrides.
*/
const
merge
=
mergeWithRules
({
module
:
{
rules
:
{
test
:
'
match
'
,
use
:
'
replace
'
}
}
})
module
.
exports
=
(
env
,
args
)
=>
{
// webpack-cli only supports these 2 modes !
if
(
args
.
mode
===
'
production
'
)
{
...
...
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