Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support node: protocol when building Playground #565

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"description": "The codebase for the ESLint PLayground (play.eslint.org)",
"license": "MIT",
"dependencies": {
"eslint": "latest"
"eslint": "github:eslint/eslint"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to test Playground with an ESLint version that uses the node: protocol. When it's verified that the Playground works well, I'll revert this change.

}
}
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