-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Skinner
committed
Sep 15, 2023
1 parent
d05609a
commit 8df0a04
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import fs from 'fs' | ||
import terser from '@rollup/plugin-terser' | ||
import replace from '@rollup/plugin-replace' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import typescript from '@rollup/plugin-typescript' | ||
import nodeResolve from '@rollup/plugin-node-resolve' | ||
|
||
// the built files for the CDN go in the top-level 'build' directory so they | ||
// can't accidentally be uploaded to NPM somehow | ||
const buildDirectory = '../../build' | ||
|
||
if (!fs.existsSync(buildDirectory)) { | ||
fs.mkdirSync(buildDirectory) | ||
} | ||
|
||
const packageJson = JSON.parse(fs.readFileSync('./package.json')) | ||
|
||
const sharedOutputOptions = { | ||
format: 'es', | ||
name: 'BugsnagVueRouterPerformance', | ||
generatedCode: { | ||
preset: 'es2015', | ||
}, | ||
sourcemap: true, | ||
} | ||
|
||
export default { | ||
input: 'lib/index.ts', | ||
output: [ | ||
{ | ||
...sharedOutputOptions, | ||
file: `${buildDirectory}/bugsnag-vue-router-performance.js`, | ||
}, | ||
{ | ||
...sharedOutputOptions, | ||
file: `${buildDirectory}/bugsnag-vue-router-performance.min.js`, | ||
compact: true, | ||
plugins: [terser({ ecma: 2015 })], | ||
}, | ||
], | ||
plugins: [ | ||
replace({ | ||
preventAssignment: true, | ||
values: { __VERSION__: packageJson.version }, | ||
}), | ||
typescript({ | ||
// don't output anything if there's a TS error | ||
noEmitOnError: true, | ||
}), | ||
commonjs(), | ||
nodeResolve({ browser: true }), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters