-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: umd support mako bundler (#750)
* feat: use mako * feat: umd support mako bundler * fix: 不需要启动 dev 服务 * chore: use the same opts for bundler * fix: delete code * chore: 调整external与platform传入方式, 与bundle-webpack对齐 * chore: add entry assert * chore: mako test case * chore: 补充 mako 测试用例 --------- Co-authored-by: Jinbao1001 <[email protected]>
- Loading branch information
1 parent
a119151
commit b3697aa
Showing
23 changed files
with
3,639 additions
and
3,961 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,14 @@ | ||
import { defineConfig } from '../../dist'; | ||
const path = require('path'); | ||
|
||
export default defineConfig({ | ||
umd: { | ||
bundler: 'mako', | ||
}, | ||
alias: { | ||
'@': path.resolve(__dirname, './src'), | ||
'hello-a': path.resolve(__dirname, './src/a.tsx'), | ||
'hello-foo': path.resolve(__dirname, './src/foo.ts'), | ||
}, | ||
platform: 'browser', | ||
}); |
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 @@ | ||
{ | ||
"hmr": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"scripts": { | ||
"build": "father build", | ||
"build:no-clean": "father build --no-clean", | ||
"dev": "father dev", | ||
"dev:no-clean": "father dev --no-clean", | ||
"doctor": "father doctor", | ||
"version": "father version" | ||
}, | ||
"dependencies": { | ||
"father": "workspace:*", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
} | ||
} |
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,15 @@ | ||
console.log('hello here'); | ||
|
||
// @ts-ignore | ||
import React from 'react'; | ||
// @ts-ignore | ||
import ReactDOM from 'react-dom'; | ||
|
||
function App({content}:{content:string}) { | ||
// @ts-ignore | ||
return <div>{content}</div>; | ||
} | ||
|
||
// @ts-ignore | ||
const root = ReactDOM.createRoot(document.getElementById('root')); | ||
root.render(<App content={'hello'}/>); |
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 @@ | ||
class Content { | ||
say() { | ||
return 'Hello father'; | ||
} | ||
} | ||
|
||
export default new Content().say(); |
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 @@ | ||
console.log('foo here'); |
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,27 @@ | ||
import content from '@/content'; | ||
import 'hello-a' | ||
import 'hello-foo' | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/* | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
// const content = 'Hello' | ||
function App() { | ||
return <div>{content}</div>; | ||
} | ||
// @ts-ignore | ||
const root = ReactDOM.createRoot(document.getElementById('root')); | ||
root.render(<App />); | ||
*/ | ||
console.log(content); |
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,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"esModuleInterop": true, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"target": "es2015", | ||
"jsx": "react", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -25,8 +25,12 @@ | |
"format": "prettier --write .", | ||
"prepare": "husky install", | ||
"release": "esno scripts/release.ts", | ||
"test": "jest", | ||
"test:cov": "jest --collectCoverage" | ||
"test": "jest --runInBand --forceExit", | ||
"test:build": "jest tests/build.test.ts", | ||
"test:cov": "jest --collectCoverage --runInBand --forceExit", | ||
"test:dev": "jest tests/dev.test.ts", | ||
"test:mako-build": "jest tests/mako.build.test.ts", | ||
"test:mako-dev": "jest tests/mako.dev.test.ts" | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
|
@@ -43,12 +47,13 @@ | |
}, | ||
"dependencies": { | ||
"@microsoft/api-extractor": "7.39.1", | ||
"@umijs/babel-preset-umi": "^4.2.8", | ||
"@umijs/bundler-utils": "^4.2.8", | ||
"@umijs/bundler-webpack": "^4.2.8", | ||
"@umijs/babel-preset-umi": "^4.2.9", | ||
"@umijs/bundler-mako": "0.5.3", | ||
"@umijs/bundler-utils": "^4.2.9", | ||
"@umijs/bundler-webpack": "^4.2.9", | ||
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1", | ||
"@umijs/core": "^4.2.8", | ||
"@umijs/utils": "^4.2.8", | ||
"@umijs/core": "^4.2.9", | ||
"@umijs/utils": "^4.2.9", | ||
"@vercel/ncc": "0.33.3", | ||
"babel-plugin-dynamic-import-node": "2.3.3", | ||
"babel-plugin-module-resolver": "4.1.0", | ||
|
@@ -66,25 +71,25 @@ | |
"v8-compile-cache": "2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.6.1", | ||
"@commitlint/config-conventional": "^17.6.1", | ||
"@swc/core": "^1.3.53", | ||
"@types/jest": "^27", | ||
"@commitlint/cli": "^17.8.1", | ||
"@commitlint/config-conventional": "^17.8.1", | ||
"@swc/core": "^1.5.24", | ||
"@types/jest": "^27.5.2", | ||
"@types/loader-runner": "2.2.4", | ||
"@types/minimatch": "3.0.5", | ||
"@types/node": "^18.15.13", | ||
"@umijs/test": "^4.0.68", | ||
"@types/node": "^18.19.34", | ||
"@umijs/test": "^4.2.9", | ||
"esno": "^0.16.3", | ||
"git-repo-info": "^2.1.1", | ||
"husky": "^8.0.3", | ||
"jest": "^27", | ||
"jest": "^27.5.1", | ||
"jest-mock-process": "^1.5.1", | ||
"lint-staged": "^13.2.1", | ||
"prettier": "^2.8.7", | ||
"prettier-plugin-organize-imports": "^3.2.2", | ||
"prettier-plugin-packagejson": "^2.4.3", | ||
"lint-staged": "^13.3.0", | ||
"prettier": "^2.8.8", | ||
"prettier-plugin-organize-imports": "^3.2.4", | ||
"prettier-plugin-packagejson": "^2.5.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.9.1", | ||
"ts-node": "^10.9.2", | ||
"zx": "^4.3.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
Oops, something went wrong.