Merge pull request #3096 from IcaroG/document-validation
fix: document validation for SSR
diff --git a/rollup.config.js b/rollup.config.js
index 0d7ad02..cb17465 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -14,13 +14,22 @@
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 @@
// noTreeShakingForStandalonePlugin(),
injectVersion(),
addNavigatorValidation(),
-]
+ addDocumentValidation(),
+];
const pluginsWithTerser = [
...plugins,
terser(),