Skip to content

Commit

Permalink
Merge pull request #3096 from IcaroG/document-validation
Browse files Browse the repository at this point in the history
fix: document validation for SSR
  • Loading branch information
AliT3 authored Nov 14, 2024
2 parents 9f9b026 + 6f6ccd0 commit 9fd4b85
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -137,7 +146,8 @@ const plugins = [
// noTreeShakingForStandalonePlugin(),
injectVersion(),
addNavigatorValidation(),
]
addDocumentValidation(),
];
const pluginsWithTerser = [
...plugins,
terser(),
Expand Down

0 comments on commit 9fd4b85

Please sign in to comment.