Skip to content

Commit

Permalink
fix(rspack): ensure process is default import
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Sep 9, 2024
1 parent bfe7d2c commit 99c043d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { waitForPortOpen } from '@nx/web/src/utils/wait-for-port-open';
import { fork } from 'child_process';
import type { Express } from 'express';
import { cpSync, existsSync, readFileSync, rmSync } from 'fs';
import * as process from 'node:process';
import { ExecutorContext } from 'nx/src/config/misc-interfaces';
import { basename, extname, join } from 'path';
import {
Expand Down Expand Up @@ -228,6 +227,16 @@ export function startProxies(
target: mappedLocationOfHost,
changeOrigin: true,
secure: sslCert ? false : undefined,
pathRewrite: (path) => {
let pathRewrite = path;
for (const app of staticRemotesConfig.remotes) {
if (path.endsWith(app)) {
pathRewrite = '/';
break;
}
}
return pathRewrite;
},
})
);
const proxyServer = (sslCert ? https : http)
Expand Down
13 changes: 9 additions & 4 deletions packages/rspack/src/utils/with-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export function withWeb(opts: WithWebOptions = {}) {

return {
...config,
experiments: {
css: true,
},
module: {
...config.module,
rules: [
Expand All @@ -51,9 +54,11 @@ export function withWeb(opts: WithWebOptions = {}) {
{
test: /\.css$/,
type: 'css',
use: [{
loader: require.resolve('postcss-loader'),
}]
use: [
{
loader: require.resolve('postcss-loader'),
},
],
},
{
test: /\.scss$|\.sass$/,
Expand Down Expand Up @@ -114,7 +119,7 @@ export function withWeb(opts: WithWebOptions = {}) {
}),
new rspack.DefinePlugin({
'process.env.NODE_ENV': isProd ? "'production'" : "'development'",
})
}),
],
};
};
Expand Down

0 comments on commit 99c043d

Please sign in to comment.