From 861abf4bb940e89a6ae3c5c3e2dad4ed0bd53b3e Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 22 Nov 2017 14:23:16 -0500 Subject: [PATCH] feat: add browser ESM build --- scripts/config.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/config.js b/scripts/config.js index 6f46e164e1..3939582837 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -75,7 +75,7 @@ const builds = { format: 'es', banner }, - // Runtime+compiler CommonJS build (ES Modules) + // Runtime+compiler ES modules build (for bundlers) 'web-full-esm': { entry: resolve('web/entry-runtime-with-compiler.js'), dest: resolve('dist/vue.esm.js'), @@ -83,6 +83,16 @@ const builds = { alias: { he: './entity-decoder' }, banner }, + // Runtime+compiler ES modules build (for direct import in browser) + 'web-full-esm-browser': { + entry: resolve('web/entry-runtime-with-compiler.js'), + dest: resolve('dist/vue.esm.browser.js'), + format: 'es', + transpile: false, + env: 'development', + alias: { he: './entity-decoder' }, + banner + }, // runtime-only build (Browser) 'web-runtime-dev': { entry: resolve('web/entry-runtime.js'), @@ -205,7 +215,6 @@ function genConfig (name) { __VERSION__: version }), flow(), - buble(), alias(Object.assign({}, aliases, opts.alias)) ].concat(opts.plugins || []), output: { @@ -227,6 +236,10 @@ function genConfig (name) { })) } + if (opts.transpile !== false) { + config.plugins.push(buble()) + } + Object.defineProperty(config, '_name', { enumerable: false, value: name