-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module-tools): load empty object instead throw error when js reso…
…lve result is false (#4796)
- Loading branch information
Showing
12 changed files
with
114 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@modern-js/module-tools': patch | ||
--- | ||
|
||
fix(module-tools): load empty object instead throw error when js resolve result is false | ||
fix(module-tools): 当 js resolve 结果为 false 时,加载空对象替代抛出错误 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 5 additions & 1 deletion
6
tests/integration/module/fixtures/build/resolve/data-url/modern.config.ts
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,3 +1,7 @@ | ||
import { defineConfig } from '@modern-js/module-tools/defineConfig'; | ||
|
||
export default defineConfig({}); | ||
export default defineConfig({ | ||
buildConfig: { | ||
input: ['./index.ts'], | ||
}, | ||
}); |
14 changes: 14 additions & 0 deletions
14
tests/integration/module/fixtures/build/resolve/false/false.test.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { runCli, initBeforeTest } from '../../../utils'; | ||
|
||
initBeforeTest(); | ||
|
||
describe('resolve', () => { | ||
const fixtureDir = __dirname; | ||
it('false', async () => { | ||
const { success } = await runCli({ | ||
argv: ['build'], | ||
appDirectory: fixtureDir, | ||
}); | ||
expect(success).toBeTruthy(); | ||
}); | ||
}); |
6 changes: 6 additions & 0 deletions
6
tests/integration/module/fixtures/build/resolve/false/index.ts
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// In some directory structure, we can not resolve './util.inspect' from 'index.js' in 'object-inspect', | ||
// For example, in bytedance internal monorepo solution, but here we can resolve it. | ||
|
||
import xxx from 'object-inspect'; | ||
|
||
console.log('xxx:', xxx); |
7 changes: 7 additions & 0 deletions
7
tests/integration/module/fixtures/build/resolve/false/modern.config.ts
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from '@modern-js/module-tools/defineConfig'; | ||
|
||
export default defineConfig({ | ||
buildConfig: { | ||
input: ['./index.ts'], | ||
}, | ||
}); |
7 changes: 7 additions & 0 deletions
7
tests/integration/module/fixtures/build/resolve/false/package.json
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "resolve-false", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"object-inspect": "1.13.0" | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
tests/integration/module/fixtures/build/resolve/node-protocol/modern.config.ts
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,3 +1,7 @@ | ||
import { defineConfig } from '@modern-js/module-tools/defineConfig'; | ||
|
||
export default defineConfig({}); | ||
export default defineConfig({ | ||
buildConfig: { | ||
input: ['./index.ts'], | ||
}, | ||
}); |