JavaScript 动态布局


golden-layout:The ultimate Javascript layout manager

The usual import declaration does not work out of the box if we use NPM + React + Webpack because React is not a peer dependency of Golden Layout.

import GoldenLayout  from 'golden-layout'

Instead, we need to first shim the module by adding React and ReactDOM as global variable. One way to do it is to use imports loader.

const GoldenLayout = require('imports?React=react&ReactDOM=react-dom!golden-layout')