From 10f6bfd94cd226d4db3b4f73d841b278bdf4f8e6 Mon Sep 17 00:00:00 2001 From: PS Date: Thu, 18 Apr 2019 16:09:29 +0200 Subject: [PATCH] fix(docz-rollup): fixed rollup configs to be Windows tolerant (#812) --- core/docz-rollup/src/index.js | 9 +++++++-- core/docz-theme-default/rollup.config.js | 2 +- core/docz/rollup.config.js | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/docz-rollup/src/index.js b/core/docz-rollup/src/index.js index e70610ab8..3188217e2 100644 --- a/core/docz-rollup/src/index.js +++ b/core/docz-rollup/src/index.js @@ -5,8 +5,13 @@ const babel = require('rollup-plugin-babel') const sizePlugin = require('./plugins/size') const copyPlugin = require('./plugins/copy') -const defaultExternal = id => - !id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/') +const defaultExternal = id => { + return ( + !id.startsWith('\0') && + !id.startsWith('.') && + !id.startsWith(process.platform === 'win32' ? process.cwd() : '/') + ) +} const output = (format, outputDir, { plugins = [], external, ...opts }) => ({ ...opts, diff --git a/core/docz-theme-default/rollup.config.js b/core/docz-theme-default/rollup.config.js index 7c2b7245f..43b573092 100644 --- a/core/docz-theme-default/rollup.config.js +++ b/core/docz-theme-default/rollup.config.js @@ -5,7 +5,7 @@ export default config({ external: id => !id.startsWith('\0') && !id.startsWith('.') && - !id.startsWith('/') && + !id.startsWith(process.platform === 'win32' ? process.cwd() : '/') && !id.startsWith('@components') && !id.startsWith('@utils') && !id.startsWith('@styles'), diff --git a/core/docz/rollup.config.js b/core/docz/rollup.config.js index 1d6ce6c3a..65ca54024 100644 --- a/core/docz/rollup.config.js +++ b/core/docz/rollup.config.js @@ -3,5 +3,7 @@ import { config } from 'docz-rollup' export default config({ input: 'src/index.ts', external: id => - !id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/'), + !id.startsWith('\0') && + !id.startsWith('.') && + !id.startsWith(process.platform === 'win32' ? process.cwd() : '/') })