Skip to content

Commit 4b1e342

Browse files
authored
Merge pull request #6761 from FlowFuse/6729-sass
chore: Replace deprecated node-sass with sass
2 parents 177fc53 + a6a3e36 commit 4b1e342

4 files changed

Lines changed: 899 additions & 84 deletions

File tree

config/webpack.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ function getPath (file) {
1616
}
1717

1818
module.exports = function (env, argv) {
19+
const devMode = argv?.mode === 'development'
1920
const config = {
20-
devtool: process.env.mode === 'production' ? 'hidden-source-map' : 'source-map',
21+
devtool: devMode ? 'source-map' : 'hidden-source-map',
2122
entry: {
2223
main: getPath('frontend/src/main.js'),
2324
setup: getPath('frontend/src/setup.js')
@@ -47,7 +48,7 @@ module.exports = function (env, argv) {
4748
include: getPath('frontend/src'),
4849
use: [
4950
{
50-
loader: MiniCssExtractPlugin.loader,
51+
loader: devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
5152
options: {}
5253
},
5354
{
@@ -79,15 +80,19 @@ module.exports = function (env, argv) {
7980
}, {
8081
test: /\.scss$/,
8182
use: [
82-
'style-loader',
83+
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
8384
{
8485
loader: 'css-loader',
8586
options: { import: true, url: true }
8687
},
8788
{
8889
loader: 'sass-loader',
8990
options: {
90-
additionalData: '@import "@/ui-components/stylesheets/ff-colors.scss";@import "@/ui-components/stylesheets/ff-utility.scss";'
91+
additionalData: '@import "@/ui-components/stylesheets/ff-colors.scss";@import "@/ui-components/stylesheets/ff-utility.scss";',
92+
sassOptions: {
93+
// Silence warnings about @import deprecation
94+
silenceDeprecations: ['import']
95+
}
9196
}
9297
}
9398

@@ -137,7 +142,7 @@ module.exports = function (env, argv) {
137142
new DotenvPlugin(),
138143
new DefinePlugin({
139144
__VUE_OPTIONS_API__: true,
140-
__VUE_PROD_DEVTOOLS__: argv?.mode === 'development'
145+
__VUE_PROD_DEVTOOLS__: devMode
141146
})
142147
],
143148
optimization: {

0 commit comments

Comments
 (0)