babel-plugin-universal-import
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "babel-plugin-universal-import", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Babel plugin to transform import() into its Universal counterpart", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -122,3 +122,22 @@ <a href="https://gitter.im/Reactlandia/Lobby" target="_blank"> | ||
## Typescript and non-Babel environments | ||
If you can't use babel, you can either copy what this plugin does above, or you can do a shorter version where you just put the important configuration key/vals on the 2nd options argument to `universal`: | ||
```js | ||
import universal from 'react-universal-component' | ||
import importCss from 'babel-plugin-universal-import/importCss.js' | ||
const load = props => Promise.all([ | ||
import( /* webpackChunkName: '[request]' */ `./${props.page}`), | ||
importCss(page) | ||
]).then(proms => proms[0]) | ||
const UniversalComponent = universal(load, { | ||
chunkName: props => props.page, | ||
resolve: props => require.resolveWeak(`./${props.page}`) | ||
}); | ||
``` | ||
> notice `chunkName` and `resolve` as standard options on the 2nd options argument. | ||
## Babel Server Or Webpack < 2.2.20 | ||
@@ -125,0 +144,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394532
201