-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: revert ESM imports/exports to cater CJS workflows (#461)
* fix: revert ESM imports/exports to cater CJS workflows * chore: update ESLint to reflect change in imports * chore: switch to use yalc instead of yarn link for tests
- Loading branch information
Showing
27 changed files
with
200 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
/* global __react_refresh_library__ */ | ||
|
||
import safeThis from 'core-js-pure/features/global-this'; | ||
import * as RefreshRuntime from 'react-refresh/runtime'; | ||
const safeThis = require('core-js-pure/features/global-this.js'); | ||
const RefreshRuntime = require('react-refresh/runtime.js'); | ||
|
||
if (process.env.NODE_ENV !== 'production' && typeof safeThis !== 'undefined') { | ||
var $RefreshInjected$ = '__reactRefreshInjected'; | ||
// Namespace the injected flag (if necessary) for monorepo compatibility | ||
if (typeof __react_refresh_library__ !== 'undefined' && __react_refresh_library__) { | ||
$RefreshInjected$ += '_' + __react_refresh_library__; | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (typeof safeThis !== 'undefined') { | ||
var $RefreshInjected$ = '__reactRefreshInjected'; | ||
// Namespace the injected flag (if necessary) for monorepo compatibility | ||
if (typeof __react_refresh_library__ !== 'undefined' && __react_refresh_library__) { | ||
$RefreshInjected$ += '_' + __react_refresh_library__; | ||
} | ||
|
||
// Only inject the runtime if it hasn't been injected | ||
if (!safeThis[$RefreshInjected$]) { | ||
// Inject refresh runtime into global scope | ||
RefreshRuntime.injectIntoGlobalHook(safeThis); | ||
// Only inject the runtime if it hasn't been injected | ||
if (!safeThis[$RefreshInjected$]) { | ||
// Inject refresh runtime into global scope | ||
RefreshRuntime.injectIntoGlobalHook(safeThis); | ||
|
||
// Mark the runtime as injected to prevent double-injection | ||
safeThis[$RefreshInjected$] = true; | ||
// Mark the runtime as injected to prevent double-injection | ||
safeThis[$RefreshInjected$] = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,4 @@ const theme = { | |
dimgrey: '343434', | ||
}; | ||
|
||
export default theme; | ||
module.exports = theme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,11 +37,11 @@ | |
"types" | ||
], | ||
"scripts": { | ||
"pretest": "yarn link && yarn link \"@pmmmwh/react-refresh-webpack-plugin\"", | ||
"posttest": "yarn unlink \"@pmmmwh/react-refresh-webpack-plugin\"", | ||
"pretest": "yalc publish --no-scripts && yalc add --dev @pmmmwh/react-refresh-webpack-plugin", | ||
"posttest": "yalc remove --all", | ||
"test": "node scripts/test.js", | ||
"test:webpack-4": "cross-env WEBPACK_VERSION=4 yarn test", | ||
"lint": "eslint --report-unused-disable-directives --ext .js .", | ||
"lint": "eslint --report-unused-disable-directives --ext .js,.jsx .", | ||
"lint:fix": "yarn lint --fix", | ||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", | ||
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\"", | ||
|
@@ -100,6 +100,7 @@ | |
"webpack-hot-middleware": "^2.25.0", | ||
"webpack-plugin-serve": "^1.4.1", | ||
"webpack.legacy": "npm:[email protected]", | ||
"yalc": "^1.0.0-pre.53", | ||
"yn": "^4.0.0" | ||
}, | ||
"peerDependencies": { | ||
|
Oops, something went wrong.