mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #24673 from iMobs/react-loadable/webpack
[react-loadable] Add server side rendering webpack plugin and getBundles helper function
This commit is contained in:
Vendored
+1
@@ -4,6 +4,7 @@
|
||||
// Oden S. <https://github.com/odensc>
|
||||
// Ian Ker-Seymer <https://github.com/ianks>
|
||||
// Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Ian Mobley <https://github.com/iMobs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import webpack = require('webpack');
|
||||
import Loadable = require('react-loadable/webpack');
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new Loadable.ReactLoadablePlugin(),
|
||||
new Loadable.ReactLoadablePlugin({
|
||||
filename: 'react-loadable.json'
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
const manifest = {
|
||||
react: [
|
||||
{
|
||||
id: 0,
|
||||
name: './node_modules/react/index.js',
|
||||
file: 'main.js'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const manifestIds = ['react'];
|
||||
|
||||
const bundles = Loadable.getBundles(manifest, manifestIds);
|
||||
@@ -19,8 +19,10 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"webpack.d.ts",
|
||||
"test/index.tsx",
|
||||
"test/webpack.ts",
|
||||
"test/imports/no-default.tsx",
|
||||
"test/imports/with-default.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
import webpack = require("webpack");
|
||||
|
||||
declare namespace LoadableExport {
|
||||
interface Options {
|
||||
filename: string;
|
||||
}
|
||||
|
||||
class ReactLoadablePlugin extends webpack.Plugin {
|
||||
constructor(opts?: Options);
|
||||
}
|
||||
|
||||
interface Bundle {
|
||||
id: number;
|
||||
name: string;
|
||||
file: string;
|
||||
}
|
||||
|
||||
interface Manifest {
|
||||
[moduleId: string]: Bundle[];
|
||||
}
|
||||
|
||||
function getBundles(manifest: Manifest, moduleIds: string[]): Bundle[];
|
||||
}
|
||||
|
||||
declare const exports: {
|
||||
getBundles: typeof LoadableExport.getBundles;
|
||||
ReactLoadablePlugin: typeof LoadableExport.ReactLoadablePlugin;
|
||||
};
|
||||
|
||||
export = exports;
|
||||
Reference in New Issue
Block a user