Fix: resolve path of regenerator-runtime (#6742)

* fix: resolve path of regenerator-runtime

* chore: update defineVitestConfig.test.ts

* chore: update defineJestConfig.test.ts
This commit is contained in:
ClarkXia 2024-01-17 16:53:35 +08:00 committed by GitHub
parent c06cb97806
commit 41be253aa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'@ice/app': patch
---
fix: resolve path of regenerator-runtime/runtime.js

View File

@ -9,6 +9,7 @@ const getDefaultTaskConfig = ({ rootDir, command }): Config => {
const defaultLogging = command === 'start' ? 'summary' : 'summary assets';
const envReplacement = path.join(rootDir, RUNTIME_TMP_DIR, 'env.ts');
const regeneratorRuntimePath = require.resolve('regenerator-runtime');
return {
mode: command === 'start' ? 'development' : 'production',
sourceMap: command === 'start' ? 'cheap-module-source-map' : false,
@ -21,7 +22,8 @@ const getDefaultTaskConfig = ({ rootDir, command }): Config => {
'webpack/hot': '@ice/bundles/compiled/webpack/hot',
// Get absolute path of `regenerator-runtime`, `@swc/helpers`
// so it's unnecessary to add it to project dependencies.
'regenerator-runtime': require.resolve('regenerator-runtime'),
'regenerator-runtime/runtime.js': regeneratorRuntimePath,
'regenerator-runtime': regeneratorRuntimePath,
'@swc/helpers': path.dirname(require.resolve('@swc/helpers/package.json')),
'universal-env': envReplacement,
'@uni/env': envReplacement,

View File

@ -11,6 +11,7 @@ describe('defineJestConfig', () => {
'^ice/types',
'^@/(.*)',
'^webpack/hot',
'^regenerator-runtime/runtime.js',
'^regenerator-runtime',
'^@swc/helpers/(.*)',
'^universal-env',

View File

@ -11,6 +11,7 @@ describe('defineVitestConfig', () => {
'ice/types',
'@',
'webpack/hot',
'regenerator-runtime/runtime.js',
'regenerator-runtime',
'@swc/helpers',
'universal-env',