๐ Bug Report: "ReferenceError: $RefreshReg$ is not defined" when starting local backend plugin
See original GitHub issue๐ Description
Iโm upgrading a local plugin + Backstage app to 1.7, and started seeing the following error when I run yarn workspace backend start
.
ReferenceError: $RefreshReg$ is not defined
It appears to be related to react-refresh and/or react-refresh-webpack-plugin? Iโm at a bit of a loss on how to debug this - Iโve been trying re-installing all my node modules, cleaning the workspace, etc, but nothing seems to be working. I was surprised that anything related to react-refresh would run on a backend plugin. My only wild guess is that the backstage-cli is not excluding react-refresh-webpack-plugin for backend plugins after this work? https://github.com/backstage/backstage/pull/10394
๐ Expected behavior
yarn workspace backend start
successfully starts.
๐ Actual Behavior with Screenshots
Full error:
/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:422
/******/ throw e;
^
ReferenceError: $RefreshReg$ is not defined
at eval (webpack-internal:///../../plugins/aws-proton-backend/dist/index.cjs.js:206:1)
at Object.../../plugins/aws-proton-backend/dist/index.cjs.js (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:118:1)
at __webpack_require__ (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:419:33)
at fn (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:579:21)
at eval (webpack-internal:///./src/plugins/scaffolder.ts:11:102)
at Module../src/plugins/scaffolder.ts (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:85:1)
at __webpack_require__ (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:419:33)
at fn (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:579:21)
at eval (webpack-internal:///./src/index.ts:11:77)
at Module../src/index.ts (/code/aws-for-backstage/personal-backstage-app/packages/backend/dist/main.js:19:1)
Relevant snippet from packages/backend/dist/main.js
where I found RefreshReg
:
var Router__default = /*#__PURE__*/ _interopDefaultLegacy(Router);\n_c = Router__default;\nvar fs__default = /*#__PURE__*/ _interopDefaultLegacy(fs);\nclass AwsProtonApi {....ctx.logger.info(`Successfully created service ${resp.service.arn}`);\n ctx.output(\"arn\", `${resp.service.arn}`);\n }\n }\n });\n};\nexports.createAwsProtonServiceAction = createAwsProtonServiceAction;\nexports.createRouter = createRouter; //# sourceMappingURL=index.cjs.js.map\nvar _c;\n$RefreshReg$(_c, \"Router__default\");
Relevant snippet from plugins/aws-proton-backend/dist/index.cjs.js
:
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
class AwsProtonApi {
....
ctx.logger.info(`Successfully created service ${resp.service.arn}`);
ctx.output("arn", `${resp.service.arn}`);
}
}
});
};
exports.createAwsProtonServiceAction = createAwsProtonServiceAction;
exports.createRouter = createRouter;
//# sourceMappingURL=index.cjs.js.map
๐ Reproduction steps
If it helps, this is how Iโm setting up my workspace: https://github.com/awslabs/aws-proton-plugins-for-backstage/blob/main/docs/developing.md
๐ Provide the context for the Bug.
No response
๐ฅ๏ธ Your Environment
$ yarn backstage-cli info
yarn run v1.22.18
$ /home/ANT.AMAZON.COM/liguori/code/aws-for-backstage/personal-backstage-app/node_modules/.bin/backstage-cli info
OS: Linux 5.15.0-52-generic - linux/x64
node: v14.21.0
yarn: 1.22.18
cli: 0.20.0 (installed)
backstage: 1.7.1
Dependencies:
@backstage/app-defaults 1.0.7
@backstage/backend-common 0.15.2
@backstage/backend-plugin-api 0.1.3
@backstage/backend-tasks 0.3.6
@backstage/catalog-client 1.1.1
@backstage/catalog-model 1.1.2
@backstage/cli-common 0.1.10
@backstage/cli 0.20.0
@backstage/config-loader 1.1.5
@backstage/config 1.0.3
@backstage/core-app-api 1.1.1
@backstage/core-components 0.11.2
@backstage/core-plugin-api 1.0.7
@backstage/dev-utils 1.0.7
@backstage/errors 1.1.2
@backstage/integration-react 1.1.5
@backstage/integration 1.3.2
@backstage/plugin-api-docs 0.8.10
@backstage/plugin-app-backend 0.3.37
@backstage/plugin-auth-backend 0.17.0
@backstage/plugin-auth-node 0.2.6
@backstage/plugin-catalog-backend 1.5.0
@backstage/plugin-catalog-common 1.0.7
@backstage/plugin-catalog-graph 0.2.22
@backstage/plugin-catalog-import 0.9.0
@backstage/plugin-catalog-node 1.2.0
@backstage/plugin-catalog-react 1.2.0
@backstage/plugin-catalog 1.6.0
@backstage/plugin-github-actions 0.5.10
@backstage/plugin-org 0.5.10
@backstage/plugin-permission-common 0.7.0
@backstage/plugin-permission-node 0.7.0
@backstage/plugin-permission-react 0.4.6
@backstage/plugin-proxy-backend 0.2.31
@backstage/plugin-scaffolder-backend 1.7.0
@backstage/plugin-scaffolder-common 1.2.1
@backstage/plugin-scaffolder 1.7.0
@backstage/plugin-search-backend-module-pg 0.4.1
@backstage/plugin-search-backend-node 1.0.3
@backstage/plugin-search-backend 1.1.0
@backstage/plugin-search-common 1.1.0
@backstage/plugin-search-react 1.2.0
@backstage/plugin-search 1.0.3
@backstage/plugin-tech-radar 0.5.17
@backstage/plugin-techdocs-backend 1.4.0
@backstage/plugin-techdocs-module-addons-contrib 1.0.5
@backstage/plugin-techdocs-node 1.4.1
@backstage/plugin-techdocs-react 1.0.5
@backstage/plugin-techdocs 1.3.3
@backstage/plugin-user-settings 0.5.0
@backstage/release-manifests 0.0.6
@backstage/test-utils 1.2.1
@backstage/theme 0.2.16
@backstage/types 1.0.0
@backstage/version-bridge 1.0.1
๐ Have you spent some time to check if this bug has been raised before?
- I checked and didnโt find similar issue
๐ข Have you read the Code of Conduct?
- I have read the Code of Conduct
Are you willing to submit PR?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
That did indeed fix the issue, thanks!
Ahhhhhh thank you for finding that! This repo went through a LOT of hacking to try to get things working initially, so I think itโs probably just left over from that. Will confirm that removing that fixes things