Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Nov 21, 2024
1 parent 311a35a commit 8a89859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/vite-plugin-canyon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-canyon",
"version": "0.0.1-alpha.13",
"version": "0.0.1-alpha.14",
"license": "MIT",
"files": [
"dist/*"
Expand Down
2 changes: 1 addition & 1 deletion plugins/vite-plugin-canyon/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function instrumentedData(args: canyonPluginOptions): string {
// 自动获取
instrumentCwd: args.instrumentCwd || process.cwd(),
}
return `(new Function("return this")()).__canyon__ = ${JSON.stringify(canyon)}`;
return `(function () {var isBrowser = typeof window!== 'undefined';var globalObj = isBrowser? window : global;return globalObj})().__canyon__ = ${JSON.stringify(canyon)}`;
}

export default function canyonPlugin(opts: canyonPluginOptions = {}): Plugin {
Expand Down

0 comments on commit 8a89859

Please sign in to comment.