mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 20:17:17 +00:00
js: Update shims setup
I finally got to testing this myself, and didn't get the existing setup to work, so I'll assume "I'm correct for now" (the famous last words). I will continue to search for a simpler setup.
This commit is contained in:
1 parent
ef9c4913cd
commit
704987dc1c
1 file changed
+3
-2
@@ -152,10 +152,11 @@ It's a common practice to load external libraries using a content delivery netwo
|
|||||||
First, add React and ReactDOM [CDN script tags](https://reactjs.org/docs/add-react-to-a-website.html#tip-minify-javascript-for-production) in your HTML template files. Then create `assets/js/shims/react.js` and `assets/js/shims/react-dom.js` with the following contents:
|
First, add React and ReactDOM [CDN script tags](https://reactjs.org/docs/add-react-to-a-website.html#tip-minify-javascript-for-production) in your HTML template files. Then create `assets/js/shims/react.js` and `assets/js/shims/react-dom.js` with the following contents:
|
||||||
```js
|
```js
|
||||||
// In assets/js/shims/react.js
|
// In assets/js/shims/react.js
|
||||||
module.exports = window.React;
|
export let React = window.React;
|
||||||
|
|
||||||
// In assets/js/shims/react-dom.js
|
// In assets/js/shims/react-dom.js
|
||||||
module.exports = window.ReactDOM;
|
export let ReactDom = window.ReactDom;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, add the following to your project's `package.json`:
|
Finally, add the following to your project's `package.json`:
|
||||||
|
|||||||
Reference in new issue
Block a user