-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: emit modern.config.json when distPath.root is absolute path (#4649)
* fix: emit modern.config.json when distPath.root is absolute path * chore: add test
- Loading branch information
1 parent
6a1d46e
commit 0db5680
Showing
11 changed files
with
122 additions
and
7 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,8 @@ | ||
--- | ||
'@modern-js/app-tools': patch | ||
'@modern-js/prod-server': patch | ||
--- | ||
|
||
fix(app-tools): failed to emit modern.config.json when distPath.root is absolute path | ||
|
||
fix(app-tools): 修复 distPath.root 为绝对路径时无法输出 modern.config.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
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.
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,10 @@ | ||
import path from 'path'; | ||
import { applyBaseConfig } from '../../utils/applyBaseConfig'; | ||
|
||
export default applyBaseConfig({ | ||
output: { | ||
distPath: { | ||
root: path.join(__dirname, 'dist/foo'), | ||
}, | ||
}, | ||
}); |
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,23 @@ | ||
{ | ||
"private": true, | ||
"name": "integration-custom-dist-path", | ||
"version": "2.9.0", | ||
"scripts": { | ||
"dev": "modern dev", | ||
"build": "modern build", | ||
"serve": "modern serve" | ||
}, | ||
"dependencies": { | ||
"@modern-js/runtime": "workspace:*", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@modern-js/app-tools": "workspace:*", | ||
"typescript": "^5", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"@types/jest": "^29", | ||
"@types/node": "^14" | ||
} | ||
} |
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,3 @@ | ||
const App = () => <div>hello</div>; | ||
|
||
export default App; |
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 path from 'path'; | ||
import { fs, OUTPUT_CONFIG_FILE } from '@modern-js/utils'; | ||
import { modernBuild } from '../../../utils/modernTestUtils'; | ||
|
||
test(`should allow distPath.root to be an absolute path`, async () => { | ||
const appDir = path.resolve(__dirname, '..'); | ||
await modernBuild(appDir); | ||
|
||
const distPath = path.join(appDir, 'dist/foo'); | ||
const configFile = path.join(distPath, OUTPUT_CONFIG_FILE); | ||
const htmlFile = path.join(distPath, 'html/main/index.html'); | ||
expect(fs.existsSync(configFile)).toBeTruthy(); | ||
expect(fs.existsSync(htmlFile)).toBeTruthy(); | ||
}); |
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,10 @@ | ||
{ | ||
"extends": "@modern-js/tsconfig/base", | ||
"compilerOptions": { | ||
"declaration": false, | ||
"jsx": "preserve", | ||
"baseUrl": "./", | ||
"outDir": "dist" | ||
}, | ||
"include": ["src", "tests", "modern.config.ts"] | ||
} |