-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
chore: optimize bundle size #3750
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# with rax | ||
|
||
https://github.com/ice-lab/icejs/tree/master/examples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"targets": ["web"], | ||
"inlineStyle": true | ||
} |
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" | ||
} | ||
} |
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" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { createElement, render } from 'rax'; | ||
import DriverUniversal from 'driver-universal'; | ||
|
||
render(<div>123</div>, document.body, { | ||
driver: DriverUniversal | ||
}); |
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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "esNext", | ||
"target": "es2015", | ||
"outDir": "build", | ||
"jsx": "preserve", | ||
"jsxFactory": "createElement", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"alwaysStrict": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"rax-app": [".rax/index.ts"], | ||
"rax": ["node_modules/@types/rax"] | ||
} | ||
}, | ||
"include": ["src/*", ".rax"], | ||
"exclude": ["build"] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,12 @@ const CONFIG = [ | |
name: 'modeConfig', | ||
validation: 'object', | ||
defaultValue: {}, | ||
} | ||
}, | ||
{ | ||
name: 'lite', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没看出 lite 模式的作用是做了什么 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 去掉了,测试了一下 |
||
validation: 'boolean', | ||
defaultValue: false | ||
}, | ||
]; | ||
|
||
module.exports = (api) => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
const path = require('path'); | ||
const { last } = require('lodash'); | ||
const formatWinPath = require('../utils/formatWinPath'); | ||
const { formatPath } = require('build-app-helpers'); | ||
|
||
function getFilename(filePath) { | ||
return last((filePath || '').split('/')); | ||
} | ||
module.exports = (config, outputAssetsPath) => { | ||
const filename = getFilename(config.output.get('filename')); | ||
config.output.filename(formatWinPath(path.join(outputAssetsPath.js || '', filename))); | ||
config.output.filename(formatPath(path.join(outputAssetsPath.js || '', filename))); | ||
|
||
if (config.plugins.get('MiniCssExtractPlugin')) { | ||
const options = config.plugin('MiniCssExtractPlugin').get('args')[0]; | ||
config.plugin('MiniCssExtractPlugin').tap((args) => [Object.assign(...args, { | ||
filename: formatWinPath(path.join(outputAssetsPath.css || '', getFilename(options.filename))), | ||
filename: formatPath(path.join(outputAssetsPath.css || '', getFilename(options.filename))), | ||
})]); | ||
} | ||
}; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后面可能需要考虑一下示例的维护和测试问题,需要有个策略,防止无限制的增加示例带来的冗余。