Skip to content

Commit

Permalink
fix: support node: protocol when building Playground (#565)
Browse files Browse the repository at this point in the history
* fix: support `node:` protocol when building Playground

* back to latest
  • Loading branch information
mdjermanovic committed May 15, 2024
1 parent 09a1c03 commit dbbf86d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";

const path = require("path");
const webpack = require("webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

/**
Expand Down Expand Up @@ -28,7 +29,15 @@ module.exports = (env, { mode }) => ({
extensions: [".js", ".jsx"],
mainFields: ["browser", "main", "module"]
},
plugins: [new NodePolyfillPlugin()],
plugins: [
new webpack.NormalModuleReplacementPlugin(
/^node:/u,
resource => {
resource.request = resource.request.replace(/^node:/u, "");
}
),
new NodePolyfillPlugin()
],
...(mode === "development" ? { devtool: "source-map" } : {}),
module: {
rules: [
Expand Down

0 comments on commit dbbf86d

Please sign in to comment.