diff --git a/rollup.config.js b/rollup.config.js index 0d7ad02a..cb17465a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,13 +14,22 @@ const injectVersion = (options = {}) => { const addNavigatorValidation = (options = {}) => { return { - name: 'inject-version', + name: 'add-navigator-validation', renderChunk: (code) => { return '(typeof navigator !== "undefined") && ' + code }, } } +const addDocumentValidation = (options = {}) => { + return { + name: 'add-document-validation', + renderChunk: (code) => { + return '(typeof document !== "undefined") && ' + code; + }, + }; +}; + const noTreeShakingForStandalonePlugin = () => { return { name: 'no-treeshaking-for-standalone', @@ -137,7 +146,8 @@ const plugins = [ // noTreeShakingForStandalonePlugin(), injectVersion(), addNavigatorValidation(), -] + addDocumentValidation(), +]; const pluginsWithTerser = [ ...plugins, terser(),