-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(miniapp): duplicated taskname when both ali and wechat are compiled * fix: compact react plugin targets is undefined (#490) * feat: rax-app support css modules (#488) * chore: CSS Modules * chore: style example * build(example): modify jsx compilerOptions to preserve in tsconfig * chore: optimize example * chore: upgrade dep version * chore: remove branch_name * chore: readme Co-authored-by: 逆葵 <[email protected]> * fix: custom output dir (#494) * fix: custom output dir * fix: ci error * fix: ci error * fix: ci yml * chore: remove useless code * feat: add enable assets * fix: compatible with build-mpa-config (#499) * chore: bump version (#497) * chore: bump version * chore: update version * chore: update version * chore: update version * fix: dep check error * chore: add changelog * chore: update version * chore: update version Co-authored-by: 逆葵 <[email protected]> Co-authored-by: NK <[email protected]> Co-authored-by: 大果 <[email protected]>
- Loading branch information
1 parent
cab9e91
commit 3a8fd66
Showing
73 changed files
with
826 additions
and
107 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
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
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,2 @@ | ||
# Basic compact with react | ||
|
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,5 @@ | ||
{ | ||
"targets": ["web"], | ||
"plugins": ["build-plugin-rax-compat-react"], | ||
"store": 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,22 @@ | ||
{ | ||
"name": "with-rax", | ||
"description": "rax example", | ||
"dependencies": { | ||
"rax": "^1.1.0", | ||
"rax-document": "^0.1.0", | ||
"rax-image": "^2.0.0", | ||
"rax-link": "^1.0.1", | ||
"rax-text": "^1.0.0", | ||
"rax-view": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/rax": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"start": "rax-app start", | ||
"build": "rax-app build" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.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,11 @@ | ||
{ | ||
"routes": [ | ||
{ | ||
"path": "/", | ||
"source": "pages/Home/index" | ||
} | ||
], | ||
"window": { | ||
"title": "Rax 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,28 @@ | ||
import { createElement } from 'rax'; | ||
import { runApp } from 'rax-app'; | ||
|
||
runApp({ | ||
router: { | ||
type: 'browser', | ||
}, | ||
app: { | ||
// ErrorBoundary | ||
errorBoundary: true, | ||
|
||
// 生命周期 | ||
onShow() { | ||
console.log('app show...'); | ||
}, | ||
onHide() { | ||
console.log('app hide...'); | ||
}, | ||
|
||
// 获取初始数据 | ||
getInitialData: async () => { | ||
return { | ||
a: 1, | ||
b: 2, | ||
}; | ||
}, | ||
}, | ||
}); |
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,22 @@ | ||
import { createElement } from 'rax'; | ||
import { Root, Style, Script, Data } from 'rax-document'; | ||
|
||
function Document(props) { | ||
return ( | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,viewport-fit=cover" /> | ||
<title>@ali/demo-app</title> | ||
<Style /> | ||
</head> | ||
<body> | ||
{/* root container */} | ||
<Root /> | ||
<Data /> | ||
<Script /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
export default Document; |
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,16 @@ | ||
.home { | ||
align-items: center; | ||
margin-top: 200rpx; | ||
} | ||
|
||
.title { | ||
font-size: 35rpx; | ||
font-weight: bold; | ||
margin: 20rpx 0; | ||
} | ||
|
||
.info { | ||
font-size: 36rpx; | ||
margin: 8rpx 0; | ||
color: #555; | ||
} |
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 React from 'react'; | ||
|
||
import './index.css'; | ||
|
||
export default function Home() { | ||
return ( | ||
React.createElement('div', {}, [123]) | ||
); | ||
} | ||
|
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 @@ | ||
# custom output dir |
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,5 @@ | ||
{ | ||
"targets": ["web", "miniapp"], | ||
"compileDependencies": [], | ||
"outputDir": "build/dist" | ||
} |
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 @@ | ||
{ | ||
"name": "with-rax", | ||
"description": "rax example", | ||
"dependencies": { | ||
"rax": "^1.1.0", | ||
"rax-document": "^0.1.0", | ||
"rax-image": "^2.0.0", | ||
"rax-link": "^1.0.1", | ||
"rax-text": "^1.0.0", | ||
"rax-view": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/rax": "^1.0.0", | ||
"miniapp-render": "^1.3.0" | ||
}, | ||
"scripts": { | ||
"start": "rax-app start", | ||
"build": "rax-app build" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.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 @@ | ||
{ | ||
"routes": [ | ||
{ | ||
"path": "/", | ||
"source": "pages/Home/index" | ||
}, | ||
{ | ||
"path": "/about", | ||
"source": "pages/About/index" | ||
} | ||
], | ||
"window": { | ||
"title": "Rax 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,28 @@ | ||
import { createElement } from 'rax'; | ||
import { runApp } from 'rax-app'; | ||
|
||
runApp({ | ||
router: { | ||
type: 'browser', | ||
}, | ||
app: { | ||
// ErrorBoundary | ||
errorBoundary: true, | ||
|
||
// 生命周期 | ||
onShow() { | ||
console.log('app show...'); | ||
}, | ||
onHide() { | ||
console.log('app hide...'); | ||
}, | ||
|
||
// 获取初始数据 | ||
getInitialData: async () => { | ||
return { | ||
a: 1, | ||
b: 2, | ||
}; | ||
}, | ||
}, | ||
}); |
27 changes: 27 additions & 0 deletions
27
examples/custom-output-dir/src/components/BuggyCounter/index.tsx
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 { createElement, Component } from 'rax'; | ||
import Text from 'rax-text'; | ||
|
||
class BuggyCounter extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { counter: 0 }; | ||
this.handleClick = this.handleClick.bind(this); | ||
} | ||
|
||
handleClick() { | ||
this.setState(({ counter }) => ({ | ||
counter: counter + 1, | ||
})); | ||
} | ||
|
||
render() { | ||
if (this.state.counter === 5) { | ||
// Simulate a JS error | ||
throw new Error('I crashed!'); | ||
} | ||
return <Text onClick={this.handleClick}>{this.state.counter}</Text>; | ||
} | ||
} | ||
|
||
|
||
export default BuggyCounter; |
Oops, something went wrong.