mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
types: add TypeScript declarations of webpack plugins (#6325)
close #6301
This commit is contained in:
parent
1b96ba7019
commit
a67b795b36
3
packages/vue-server-renderer/client-plugin.d.ts
vendored
Normal file
3
packages/vue-server-renderer/client-plugin.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { WebpackPlugin } from './types/plugin';
|
||||
declare const Plugin: WebpackPlugin;
|
||||
export = Plugin;
|
@ -28,12 +28,13 @@
|
||||
"lodash.template": "^4.4.0",
|
||||
"lodash.uniq": "^4.5.0",
|
||||
"resolve": "^1.2.0",
|
||||
"source-map": "0.5.6",
|
||||
"serialize-javascript": "^1.3.0"
|
||||
"serialize-javascript": "^1.3.0",
|
||||
"source-map": "0.5.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^7.0.22",
|
||||
"typescript": "^2.3.3",
|
||||
"@types/webpack": "^3.0.6",
|
||||
"typescript": "^2.4.2",
|
||||
"vue": "file:../.."
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer#readme"
|
||||
|
3
packages/vue-server-renderer/server-plugin.d.ts
vendored
Normal file
3
packages/vue-server-renderer/server-plugin.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { WebpackPlugin } from './types/plugin';
|
||||
declare const Plugin: WebpackPlugin;
|
||||
export = Plugin;
|
9
packages/vue-server-renderer/types/plugin.d.ts
vendored
Normal file
9
packages/vue-server-renderer/types/plugin.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
interface WebpackPluginOptions {
|
||||
filename?: string;
|
||||
}
|
||||
|
||||
export interface WebpackPlugin {
|
||||
new (options?: WebpackPluginOptions): Plugin;
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
import Vue = require('vue');
|
||||
import VueSSRClientPlugin = require('../client-plugin');
|
||||
import VueSSRServerPlugin = require('../server-plugin');
|
||||
import webpack = require('webpack');
|
||||
import { readFileSync } from 'fs';
|
||||
import { createRenderer, createBundleRenderer } from '../';
|
||||
|
||||
@ -82,3 +85,15 @@ bundleRenderer.renderToString(context, (err, html) => {
|
||||
bundleRenderer.renderToStream(context).on('data', chunk => {
|
||||
const html = chunk.toString();
|
||||
});
|
||||
|
||||
// webpack plugins
|
||||
webpack({
|
||||
plugins: [
|
||||
new VueSSRClientPlugin({
|
||||
filename: 'client-manifest.json'
|
||||
}),
|
||||
new VueSSRServerPlugin({
|
||||
filename: 'server-bundle.json'
|
||||
})
|
||||
]
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user