Skip to content

Commit

Permalink
Replace ESM constants to ts constants
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Feb 13, 2025
1 parent 29ab516 commit fc28c68
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import postBuild from './post-build';

import * as webpack from 'webpack';
import type { WebpackConfiguration } from 'webpack-cli';
import path from 'path';

export const plugins = (vars: Variables): WebpackConfiguration['plugins'] => {
const {
Expand All @@ -22,7 +23,9 @@ export const plugins = (vars: Variables): WebpackConfiguration['plugins'] => {
onlyTS,
debug,
exclude,
progressFunction
progressFunction,
superDirname,
dirname
} = vars;

const plugins: Array<webpack.ProgressPlugin | webpack.DelegatedPlugin> = [
Expand Down Expand Up @@ -73,5 +76,15 @@ export const plugins = (vars: Variables): WebpackConfiguration['plugins'] => {
})
);

if (superDirname !== dirname) {
// Because constants are used webpack define plugin
plugins.push(
new webpack.NormalModuleReplacementPlugin(
/core\/constants/,
path.join(superDirname, './src/core/constants.ts')
)
);
}

return plugins;
};

0 comments on commit fc28c68

Please sign in to comment.