Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: umd support mako bundler #750

Merged
merged 15 commits into from
Jun 4, 2024
14 changes: 14 additions & 0 deletions examples/mako/.fatherrc.ts
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',
});
3 changes: 3 additions & 0 deletions examples/mako/mako.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"hmr": false
}
15 changes: 15 additions & 0 deletions examples/mako/package.json
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"
}
}
15 changes: 15 additions & 0 deletions examples/mako/src/a.tsx
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'}/>);
7 changes: 7 additions & 0 deletions examples/mako/src/content.tsx
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();
1 change: 1 addition & 0 deletions examples/mako/src/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('foo here');
27 changes: 27 additions & 0 deletions examples/mako/src/index.tsx
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);
19 changes: 19 additions & 0 deletions examples/mako/tsconfig.json
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/*"]
}
}
}
43 changes: 24 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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",
Expand All @@ -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]",
Expand Down
Loading
Loading