diff --git a/packages/vue-server-renderer/client-plugin.d.ts b/packages/vue-server-renderer/client-plugin.d.ts new file mode 100644 index 00000000..005c0f61 --- /dev/null +++ b/packages/vue-server-renderer/client-plugin.d.ts @@ -0,0 +1,3 @@ +import { WebpackPlugin } from './types/plugin'; +declare const Plugin: WebpackPlugin; +export = Plugin; diff --git a/packages/vue-server-renderer/package.json b/packages/vue-server-renderer/package.json index d5bd1520..5a747220 100644 --- a/packages/vue-server-renderer/package.json +++ b/packages/vue-server-renderer/package.json @@ -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" diff --git a/packages/vue-server-renderer/server-plugin.d.ts b/packages/vue-server-renderer/server-plugin.d.ts new file mode 100644 index 00000000..005c0f61 --- /dev/null +++ b/packages/vue-server-renderer/server-plugin.d.ts @@ -0,0 +1,3 @@ +import { WebpackPlugin } from './types/plugin'; +declare const Plugin: WebpackPlugin; +export = Plugin; diff --git a/packages/vue-server-renderer/types/plugin.d.ts b/packages/vue-server-renderer/types/plugin.d.ts new file mode 100644 index 00000000..50b64229 --- /dev/null +++ b/packages/vue-server-renderer/types/plugin.d.ts @@ -0,0 +1,9 @@ +import { Plugin } from 'webpack'; + +interface WebpackPluginOptions { + filename?: string; +} + +export interface WebpackPlugin { + new (options?: WebpackPluginOptions): Plugin; +} diff --git a/packages/vue-server-renderer/types/test.ts b/packages/vue-server-renderer/types/test.ts index 06e2759a..381b85cf 100644 --- a/packages/vue-server-renderer/types/test.ts +++ b/packages/vue-server-renderer/types/test.ts @@ -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' + }) + ] +});