Skip to content

Commit f1bea3c

Browse files
authored
Add webpack EnvironmentPlugin (go-gitea#32661)
Fixes: go-gitea#32660 Environment vars in Webpack need to be declared in the config, otherwise they will not be elimininated during compilation.
1 parent f62f68c commit f1bea3c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: webpack.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import tailwindcssNesting from 'tailwindcss/nesting/index.js';
1717
import postcssNesting from 'postcss-nesting';
1818

1919
const {EsbuildPlugin} = EsBuildLoader;
20-
const {SourceMapDevToolPlugin, DefinePlugin} = webpack;
20+
const {SourceMapDevToolPlugin, DefinePlugin, EnvironmentPlugin} = webpack;
2121
const formatLicenseText = (licenseText) => wrapAnsi(licenseText || '', 80).trim();
2222

2323
const glob = (pattern) => fastGlob.sync(pattern, {
@@ -213,6 +213,10 @@ export default {
213213
__VUE_PROD_DEVTOOLS__: false, // do not enable devtools support in production
214214
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false, // https://github.com/vuejs/vue-cli/pull/7443
215215
}),
216+
// all environment variables used in bundled js via process.env must be declared here
217+
new EnvironmentPlugin({
218+
TEST: 'false',
219+
}),
216220
new VueLoaderPlugin(),
217221
new MiniCssExtractPlugin({
218222
filename: 'css/[name].css',

0 commit comments

Comments
 (0)