Aggiungi DefinePlugin per la gestione dell'ambiente e aggiorna gli URL API per la produzione

This commit is contained in:
2026-05-08 17:39:34 +02:00
parent b4fb52617a
commit 559d7c0ba0
4 changed files with 27 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { ProvidePlugin } = require('webpack');
const { ProvidePlugin, DefinePlugin } = require('webpack');
const path = require('path');
@@ -12,6 +12,9 @@ module.exports = {
},
devtool: 'source-map',
plugins: [
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
new ProvidePlugin({
$: 'jquery', // Rende $ disponibile globalmente
jQuery: 'jquery',

View File

@@ -1,7 +1,7 @@
const commonConfiguration = require('./webpack.common.js');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { ProvidePlugin } = require('webpack');
const { ProvidePlugin, DefinePlugin } = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
@@ -16,6 +16,9 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin(),
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new ProvidePlugin({
$: 'jquery', // Rende $ disponibile globalmente
jQuery: 'jquery',