Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/webpack-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default class CodePressWebpackPlugin {

if (!aliases.has("@")) {
const tsconfigPath = path.join(compiler.context, "tsconfig.json");
console.log("[CodePress] Looking for @ alias in tsconfig:", tsconfigPath);

try {
if (fs.existsSync(tsconfigPath)) {
Expand All @@ -127,7 +126,6 @@ export default class CodePressWebpackPlugin {

if (pathsMatch) {
const pathsContent = pathsMatch[1];
console.log("[CodePress] Found paths block:", pathsContent.trim());

// Extract individual path mappings: "@/*": ["./src/*"]
const pathPattern = /"([^"]+)"\s*:\s*\[\s*"([^"]+)"/g;
Expand All @@ -143,15 +141,7 @@ export default class CodePressWebpackPlugin {
.replace(/\/\*$/, "");

aliases.set(alias, targetPath);
console.log(
"[CodePress] Added alias from tsconfig:",
alias,
"->",
targetPath
);
}
} else {
console.log("[CodePress] No paths block found in tsconfig");
}
}
} catch (e) {
Expand All @@ -163,7 +153,6 @@ export default class CodePressWebpackPlugin {
const srcDir = path.join(compiler.context, "src");
if (fs.existsSync(srcDir)) {
aliases.set("@", "src");
console.log("[CodePress] Using default Next.js alias: @ → src");
}
}
}
Expand Down Expand Up @@ -196,26 +185,17 @@ export default class CodePressWebpackPlugin {
* Apply the plugin to the webpack compiler
*/
public apply(compiler: Compiler): void {
console.log("[CodePress] Plugin apply() called with options:", {
isServer: this.options.isServer,
dev: this.options.dev,
});

// Skip server builds entirely
if (this.options.isServer) {
console.log("[CodePress] Skipping: isServer=true");
return;
}

// Skip dev mode - module mapping not needed (dev has named IDs)
// and env vars are handled by the SWC plugin
if (this.options.dev) {
console.log("[CodePress] Skipping: dev=true");
return;
}

console.log("[CodePress] Running in production mode, will build MODULE_MAP");

// Disable optimizations that break CodePress preview in production builds.
// This is REQUIRED for CodePress preview to work because:
//
Expand Down