-
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: compact react plugin targets is undefined (#490)
- Loading branch information
Showing
14 changed files
with
122 additions
and
17 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,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 |
---|---|---|
@@ -1,3 +1 @@ | ||
# with rax miniapp compile | ||
|
||
https://github.com/ice-lab/icejs/tree/master/examples |
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 @@ | ||
# with rax mpa | ||
|
||
https://github.com/ice-lab/icejs/tree/master/examples |
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 @@ | ||
# with rax | ||
|
||
https://github.com/ice-lab/icejs/tree/master/examples |
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 @@ | ||
# with rax | ||
|
||
https://github.com/ice-lab/icejs/tree/master/examples |
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,3 @@ | ||
{ | ||
"targets": ["kraken"] | ||
"targets": ["web", "weex", "kraken", "miniapp", "wechat-miniprogram"] | ||
} |
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,10 +1,7 @@ | ||
module.exports = ({ onGetWebpackConfig, getValue }) => { | ||
const targets = getValue('targets'); | ||
targets.forEach((target) => { | ||
onGetWebpackConfig(target, (config) => { | ||
config.resolve.alias | ||
.set('react', 'rax/lib/compat') | ||
.set('react-dom', 'rax-dom'); | ||
}); | ||
module.exports = ({ onGetWebpackConfig }) => { | ||
onGetWebpackConfig((config) => { | ||
config.resolve.alias | ||
.set('react', 'rax/lib/compat') | ||
.set('react-dom', 'rax-dom'); | ||
}); | ||
}; |