Skip to content

Commit

Permalink
Merge pull request #2830 from online-go/build-production
Browse files Browse the repository at this point in the history
Fix for production builds to work with @ imports
  • Loading branch information
anoek authored Sep 11, 2024
2 parents 796b1bc + bfdb984 commit 4b40715
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import fs from "fs";
import path from "path";
import webpack from "webpack"
import { fileURLToPath } from 'url';
import webpack from "webpack";
import { fileURLToPath } from "url";
import pkg from "./package.json" with { type: "json" };
import TerserPlugin from "terser-webpack-plugin";
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
Expand Down Expand Up @@ -50,12 +50,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
export default (env, argv) => {
const production = argv.mode === "production";
let alias = {
"@": path.resolve(__dirname, '/src'),
"@": path.resolve(__dirname, "/src"),
};

if (production) {
console.log("Production build, enabling react profiling");
alias = {
"@": path.resolve(__dirname, "/src"),
"react-dom$": "react-dom/profiling",
"scheduler/tracing": "scheduler/tracing-profiling",
};
Expand All @@ -71,7 +72,9 @@ export default (env, argv) => {
allowAsyncCycles: false,
cwd: process.cwd(),
onDetected({ module: webpackModuleRecord, paths, compilation }) {
compilation.errors.push(new Error("Circular dependency found:\n " + paths.join("\n -> ")));
compilation.errors.push(
new Error("Circular dependency found:\n " + paths.join("\n -> ")),
);
},
}),
);
Expand Down

0 comments on commit 4b40715

Please sign in to comment.