mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
chore(node): upgrade to Node 20
This commit is contained in:
@@ -3,7 +3,6 @@ const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const nconf = require('nconf');
|
||||
const vueTemplateCompiler = require('vue-template-babel-compiler');
|
||||
const { DuplicatesPlugin } = require('inspectpack/plugin');
|
||||
const setupNconf = require('../server/libs/setupNconf');
|
||||
const pkg = require('./package.json');
|
||||
|
||||
@@ -36,25 +35,26 @@ const envObject = {};
|
||||
|
||||
envVars
|
||||
.forEach(key => {
|
||||
envObject[key] = nconf.get(key);
|
||||
envObject[`process.env.${key}`] = `'${nconf.get(key)}'`;
|
||||
});
|
||||
|
||||
const enableDuplicatesPlugin = process.env.npm_lifecycle_event !== 'storybook:serve';
|
||||
|
||||
const webpackPlugins = [
|
||||
new webpack.EnvironmentPlugin(envObject),
|
||||
new webpack.DefinePlugin(envObject),
|
||||
new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
|
||||
];
|
||||
|
||||
if (enableDuplicatesPlugin) {
|
||||
webpackPlugins.splice(0, 0, new DuplicatesPlugin({
|
||||
verbose: true,
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
assetsDir: 'static',
|
||||
configureWebpack: {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.svg/,
|
||||
dependency: { not: ['url'] },
|
||||
type: 'asset/source',
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: webpackPlugins,
|
||||
},
|
||||
chainWebpack: config => {
|
||||
@@ -66,63 +66,6 @@ module.exports = {
|
||||
.set(dep, path.resolve(__dirname, `./node_modules/${dep}`));
|
||||
});
|
||||
|
||||
const svgRule = config.module.rule('svg');
|
||||
|
||||
// clear all existing loaders.
|
||||
// if you don't do this, the loader below will be appended to
|
||||
// existing loaders of the rule.
|
||||
svgRule.uses.clear();
|
||||
|
||||
// add replacement loader(s)
|
||||
svgRule
|
||||
.test(/\.svg$/)
|
||||
.oneOf('normal')
|
||||
.exclude
|
||||
.add(path.resolve(__dirname, 'src/assets/svg/for-css'))
|
||||
.end()
|
||||
.use('svg-inline-loader')
|
||||
.loader('svg-inline-loader')
|
||||
.end()
|
||||
.use('svgo-loader')
|
||||
.loader('svgo-loader')
|
||||
.options({
|
||||
plugins: [
|
||||
{ removeViewBox: false },
|
||||
{ convertPathData: { noSpaceAfterFlags: false } },
|
||||
],
|
||||
})
|
||||
.end()
|
||||
.end()
|
||||
.oneOf('in-css')
|
||||
.include
|
||||
.add(path.resolve(__dirname, 'src/assets/svg/for-css'))
|
||||
.end()
|
||||
.use('svg-in-css')
|
||||
.loader('svg-url-loader')
|
||||
.options({
|
||||
limit: 4000,
|
||||
name: 'static/svg/[contenthash].[ext]',
|
||||
})
|
||||
.end()
|
||||
.use('svgo-loader')
|
||||
.loader('svgo-loader')
|
||||
.options({
|
||||
plugins: [
|
||||
{ removeViewBox: false },
|
||||
{ convertPathData: { noSpaceAfterFlags: false } },
|
||||
],
|
||||
});
|
||||
|
||||
// Disable eslint warnings when running the server
|
||||
config.module
|
||||
.rule('eslint')
|
||||
.use('eslint-loader')
|
||||
.loader('eslint-loader')
|
||||
.tap(options => {
|
||||
options.quiet = true;
|
||||
return options;
|
||||
});
|
||||
|
||||
// Fix issue with Safari cache, see https://github.com/vuejs/vue-cli/issues/2509
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
config.plugins.delete('preload');
|
||||
@@ -140,7 +83,6 @@ module.exports = {
|
||||
|
||||
devServer: {
|
||||
headers: { 'Cache-Control': 'no-store' },
|
||||
disableHostCheck: true,
|
||||
proxy: {
|
||||
// proxy all requests to the server at IP:PORT as specified in the top-level config
|
||||
'^/api/v3': {
|
||||
|
||||
Reference in New Issue
Block a user