-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new loadable.lib, change API
BREAKING CHANGE: - `ErrorComponent` is ignored, please use Error Boundaries to handle errors. - `lazy` is no longer exported - `LoadingComponent` is replaced by `fallback` option - `ref` are now forwarded
- Loading branch information
Showing
27 changed files
with
8,767 additions
and
236 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"env": { | ||
"browser": true | ||
}, | ||
"rules": { | ||
"import/no-unresolved": "off" | ||
} | ||
} |
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,4 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-react'], | ||
plugins: ['@babel/plugin-syntax-dynamic-import'], | ||
} |
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,21 @@ | ||
{ | ||
"name": "client-side", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "webpack-dev-server" | ||
}, | ||
"devDependencies": { | ||
"babel-loader": "^8.0.4", | ||
"html-webpack-plugin": "^3.2.0", | ||
"webpack": "^4.23.1", | ||
"webpack-cli": "^3.1.2", | ||
"webpack-dev-server": "^3.1.10" | ||
}, | ||
"dependencies": { | ||
"moment": "^2.22.2", | ||
"react": "^16.6.0", | ||
"react-dom": "^16.6.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 @@ | ||
export default () => '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,18 @@ | ||
import React from 'react' | ||
import { render } from 'react-dom' | ||
import loadable from '../../../packages/component' | ||
|
||
const Hello = loadable(() => import('./Hello')) | ||
const Moment = loadable.lib(() => import('moment')) | ||
|
||
const App = () => ( | ||
<div> | ||
<Hello /> | ||
<Moment>{({ default: moment }) => moment().format('HH:mm')}</Moment> | ||
</div> | ||
) | ||
|
||
const root = document.createElement('div') | ||
document.body.append(root) | ||
|
||
render(<App />, root) |
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 @@ | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
|
||
module.exports = { | ||
mode: 'development', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js?$/, | ||
exclude: /node_modules/, | ||
use: 'babel-loader', | ||
}, | ||
], | ||
}, | ||
plugins: [new HtmlWebpackPlugin()], | ||
} |
Oops, something went wrong.