mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-06 06:07:33 +02:00
Fix an issue that couldn't link to other pattern
This commit is contained in:
1
.babelrc
1
.babelrc
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"plugins": ["@loadable/babel-plugin"],
|
||||
"presets": [
|
||||
"@babel/preset-env",
|
||||
"@babel/preset-react"
|
||||
|
@@ -5,7 +5,16 @@ import './spinner.css';
|
||||
|
||||
const slug = item => item.toLowerCase().split(' ').join('-');
|
||||
|
||||
const DetailsLoader = loadable(props => import(`../patterns/${slug(props.pattern)}/Details`), {
|
||||
// In order to create a link to another page that is dynamically loaded (via <Link to="...">),
|
||||
// the page chunks have to be loadable by @loadable.
|
||||
// We have to add a magic comment /* #__LOADABLE__ */ here
|
||||
// and the following plugin to Babel's settings (.babelrc):
|
||||
// {
|
||||
// "plugins": ["@loadable/babel-plugin"],
|
||||
// }
|
||||
const loadDetails = /* #__LOADABLE__ */ (props) => import(`../patterns/${slug(props.pattern)}/Details`)
|
||||
|
||||
const DetailsLoader = loadable(loadDetails, {
|
||||
fallback: (
|
||||
<div className="w100 h-100 flex items-center justify-center">
|
||||
<svg className="spinner" width="64px" height="64px" viewBox="0 0 32 32">
|
||||
|
9
package-lock.json
generated
9
package-lock.json
generated
@@ -1942,6 +1942,15 @@
|
||||
"regenerator-runtime": "^0.13.2"
|
||||
}
|
||||
},
|
||||
"@loadable/babel-plugin": {
|
||||
"version": "5.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@loadable/babel-plugin/-/babel-plugin-5.10.3.tgz",
|
||||
"integrity": "sha512-Izo4QX526f/Czvdot1izg0DtA5DfJEW5RUN28/9wt+62It4xKhVv9l0NNcTEL39xJXj7lsE4k5Z6eCBSETpHmw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0"
|
||||
}
|
||||
},
|
||||
"@loadable/component": {
|
||||
"version": "5.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@loadable/component/-/component-5.10.3.tgz",
|
||||
|
@@ -21,6 +21,7 @@
|
||||
"@babel/core": "^7.7.4",
|
||||
"@babel/preset-env": "^7.7.4",
|
||||
"@babel/preset-react": "^7.7.4",
|
||||
"@loadable/babel-plugin": "^5.10.3",
|
||||
"babel-loader": "^8.0.6",
|
||||
"css-loader": "^3.2.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
|
Reference in New Issue
Block a user