]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: refactor build exports
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 24 Jan 2020 09:08:55 +0000 (10:08 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 24 Jan 2020 09:08:55 +0000 (10:08 +0100)
package.json
rollup.config.js
src/entries/iife.ts [deleted file]
yarn.lock

index cd016836aac367737a80c35b392b2ec7b28b407e..28b9da7a1c659f2a0564cc2756e9bf08e5c192ea 100644 (file)
@@ -2,10 +2,10 @@
   "name": "vue-router",
   "private": true,
   "version": "4.0.0-alpha.0",
-  "main": "src/index.ts",
-  "browser": "dist/vue-router.browser.esm.js",
+  "main": "dist/vue-router.cjs.js",
+  "browser": "dist/vue-router.esm.js",
   "unpkg": "dist/vue-router.js",
-  "module": "dist/vue-router.esm.js",
+  "module": "dist/vue-router.esm-bundler.js",
   "types": "dist/index.d.ts",
   "license": "MIT",
   "scripts": {
@@ -29,7 +29,7 @@
     "@types/webpack-env": "^1.15.0",
     "@vue/compiler-sfc": "^3.0.0-alpha.3",
     "axios": "^0.19.2",
-    "browserstack-local": "^1.4.4",
+    "browserstack-local": "^1.4.5",
     "chromedriver": "^79.0.0",
     "codecov": "^3.6.2",
     "consola": "^2.11.3",
@@ -42,7 +42,7 @@
     "nightwatch": "^1.3.2",
     "nightwatch-helpers": "^1.2.0",
     "prettier": "^1.19.1",
-    "rollup": "^1.29.0",
+    "rollup": "^1.29.1",
     "rollup-plugin-commonjs": "^10.1.0",
     "rollup-plugin-terser": "^5.2.0",
     "rollup-plugin-typescript2": "^0.25.3",
index 3568bfdd2873a5a1734f86b25b6c3eff8f900b88..2580dd6c60e6ff8957e9dd05d371423e5a10a4cb 100644 (file)
@@ -34,18 +34,18 @@ function createEntry(
   if (minify) env = 'production'
   const isProductionBuild =
     process.env.__DEV__ === 'false' || env === 'production'
-  const isBundlerESMBuild = format === 'es'
 
   const config = {
     input,
     plugins: [
       replace({
         __VERSION__: JSON.stringify(pkg.version),
-        __DEV__: isBundlerESMBuild
-          ? // preserve to be handled by bundlers
-            `process.env.NODE_ENV !== 'production'`
-          : // hard coded dev/prod builds
-            !isProductionBuild,
+        __DEV__:
+          (format === 'es' && !isBrowser) || format === 'cjs'
+            ? // preserve to be handled by bundlers
+              `process.env.NODE_ENV !== 'production'`
+            : // hard coded dev/prod builds
+              !isProductionBuild,
       }),
       alias({
         resolve: ['ts'],
@@ -56,6 +56,11 @@ function createEntry(
       banner,
       file: 'dist/vue-router.other.js',
       format,
+      globals: {
+        '@vue/reactivity': 'Vue',
+        '@vue/runtime-core': 'Vue',
+        vue: 'Vue',
+      },
     },
   }
 
@@ -94,9 +99,9 @@ function createEntry(
     config.plugins.push(
       terser({
         module: format === 'es',
-        output: {
-          preamble: banner,
-        },
+        // output: {
+        //   preamble: banner,
+        // },
       })
     )
     config.output.file = config.output.file.replace(/\.js$/i, '.min.js')
@@ -110,7 +115,7 @@ export default [
   createEntry({ format: 'iife' }),
   createEntry({ format: 'iife', minify: true }),
   createEntry({ format: 'cjs' }),
+  // TODO: prod vs env
   createEntry({ format: 'es' }),
   createEntry({ format: 'es', isBrowser: true }),
-  createEntry({ format: 'es', isBrowser: true, minify: true }),
 ]
diff --git a/src/entries/iife.ts b/src/entries/iife.ts
deleted file mode 100644 (file)
index 01d3ba6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import * as VueRouter from '../index'
-
-// declare module '../index' {
-//   interface BackwardsCompatibleRouter {
-//     Router: BaseRouter
-//     install: typeof plugin
-//     HTML5History: HTML5History
-//   }
-// }
-
-export default VueRouter
index 4efd8e7b6394c4278fc72d34957597308ddebd5b..28d82e83d2041790f037bcc607f31328646e86e9 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -1475,10 +1475,10 @@ browserify-zlib@^0.2.0:
   dependencies:
     pako "~1.0.5"
 
-browserstack-local@^1.4.4:
-  version "1.4.4"
-  resolved "https://registry.yarnpkg.com/browserstack-local/-/browserstack-local-1.4.4.tgz#993cf7860509e78eb3aa44888b3b5cb1aec60156"
-  integrity sha512-RAnOqO6/l1JVBLkhG2kfy8gUPpAXnWlgVN7VT7CrTkxpqKjBmZXy0jX6+3ES9XeY6l8yIKYbSOq3Jsg2ye9XUg==
+browserstack-local@^1.4.5:
+  version "1.4.5"
+  resolved "https://registry.yarnpkg.com/browserstack-local/-/browserstack-local-1.4.5.tgz#115153ce1d08d58b7575ecf4381d54d10b42d2cf"
+  integrity sha512-0/VdSv2YVXmcnwBb64XThMvjM1HnZJnPdv7CUgQbC5y/N9Wsr0Fu+j1oknE9fC/VPx9CpoSC6CJ0kza42skMSA==
   dependencies:
     https-proxy-agent "^4.0.0"
     is-running "^2.1.0"
@@ -6514,10 +6514,10 @@ rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2:
   dependencies:
     estree-walker "^0.6.1"
 
-rollup@^1.29.0:
-  version "1.29.0"
-  resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.29.0.tgz#6a1a79eea43ca9d3d79a90c15a1ceecedc72097b"
-  integrity sha512-V63Iz0dSdI5qPPN5HmCN6OBRzBFhMqNWcvwgq863JtSCTU6Vdvqq6S2fYle/dSCyoPrBkIP3EIr1RVs3HTRqqg==
+rollup@^1.29.1:
+  version "1.29.1"
+  resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.29.1.tgz#8715d0a4ca439be3079f8095989ec8aa60f637bc"
+  integrity sha512-dGQ+b9d1FOX/gluiggTAVnTvzQZUEkCi/TwZcax7ujugVRHs0nkYJlV9U4hsifGEMojnO+jvEML2CJQ6qXgbHA==
   dependencies:
     "@types/estree" "*"
     "@types/node" "*"