How to use babel-plugin-universal-import - 2 common examples

To help you get started, we’ve selected a few babel-plugin-universal-import examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cescoferraro / react-boil / app / components / user / index.tsx View on Github external
load: () => Promise.all([
            System.import(/* webpackChunkName: 'user' */ "./user"),
            importCss("user")]).then(promises => promises[0]),
        chunkName: () => "user",
github cescoferraro / react-boil / app / components / user / index.tsx View on Github external
import universal from "react-universal-component"
declare var System: any
import * as importCss from 'babel-plugin-universal-import/importCss.js'
import * as universalImport from 'babel-plugin-universal-import/universalImport.js'


declare var __dirname: any
export const AsyncUser = universal(
    universalImport({
        load: () => Promise.all([
            System.import(/* webpackChunkName: 'user' */ "./user"),
            importCss("user")]).then(promises => promises[0]),
        chunkName: () => "user",
        resolve: () => require.resolveWeak('./user'),
    })
)

babel-plugin-universal-import

Babel plugin to transform import() into its Universal counterpart

MIT
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis