-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(build): Handle minification in rollup config generation function (#…
…4681) As part of the new build process, this removes minification config from being hardcoded in individual `rollup.config.js` files and instead uses a new function in the main `rollup.config.js` to generate minified and unminified variants of each build config it's given. This also includes a few other small changes: - Moved the license plugin to the main config function. - Removed exports which were no longer necessary now that most config is centralized. - Refactored individual `rollup.config.js` files to have more parallel structure. - Moved a comment and renamed the `markAsBrowserBulid` plugin so it has the work "plugin" in its name.
- Loading branch information
1 parent
61c79ef
commit a1e97ea
Showing
6 changed files
with
152 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,17 @@ | ||
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config'; | ||
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config'; | ||
|
||
const builds = []; | ||
|
||
const licensePlugin = makeLicensePlugin(); | ||
|
||
['es5', 'es6'].forEach(jsVersion => { | ||
const baseBundleConfig = makeBaseBundleConfig({ | ||
input: 'src/index.ts', | ||
isAddOn: false, | ||
jsVersion, | ||
licenseTitle: '@sentry/browser', | ||
outputFileBase: `build/bundle${jsVersion === 'es6' ? '.es6' : ''}`, | ||
}); | ||
|
||
builds.push( | ||
...[ | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, licensePlugin], | ||
}, | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.min.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin], | ||
}, | ||
], | ||
); | ||
builds.push(...makeMinificationVariants(baseBundleConfig)); | ||
}); | ||
|
||
export default builds; |
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 |
---|---|---|
@@ -1,37 +1,17 @@ | ||
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config'; | ||
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config'; | ||
|
||
const builds = []; | ||
|
||
const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser'); | ||
|
||
['es5', 'es6'].forEach(jsVersion => { | ||
const baseBundleConfig = makeBaseBundleConfig({ | ||
input: 'src/index.bundle.ts', | ||
isAddOn: false, | ||
jsVersion, | ||
licenseTitle: '@sentry/tracing & @sentry/browser', | ||
outputFileBase: `build/bundle.tracing${jsVersion === 'es6' ? '.es6' : ''}`, | ||
}); | ||
|
||
builds.push( | ||
...[ | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, licensePlugin], | ||
}, | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.min.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin], | ||
}, | ||
], | ||
); | ||
builds.push(...makeMinificationVariants(baseBundleConfig)); | ||
}); | ||
|
||
export default builds; |
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 |
---|---|---|
@@ -1,29 +1,11 @@ | ||
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config'; | ||
|
||
const licensePlugin = makeLicensePlugin(); | ||
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config'; | ||
|
||
const baseBundleConfig = makeBaseBundleConfig({ | ||
input: 'src/index.bundle.ts', | ||
isAddOn: false, | ||
jsVersion: 'es5', | ||
licenseTitle: '@sentry/vue', | ||
outputFileBase: 'build/bundle.vue', | ||
}); | ||
|
||
export default [ | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, licensePlugin], | ||
}, | ||
{ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}.min.js`, | ||
}, | ||
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin], | ||
}, | ||
]; | ||
export default makeMinificationVariants(baseBundleConfig); |
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 |
---|---|---|
@@ -1,34 +1,11 @@ | ||
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config'; | ||
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config'; | ||
|
||
const baseBundleConfig = makeBaseBundleConfig({ | ||
input: 'src/index.ts', | ||
isAddOn: true, | ||
jsVersion: 'es5', | ||
licenseTitle: '@sentry/wasm', | ||
outputFileBase: 'build/wasm', | ||
}); | ||
|
||
function loadAllIntegrations() { | ||
const builds = []; | ||
[ | ||
{ | ||
extension: '.js', | ||
plugins: baseBundleConfig.plugins, | ||
}, | ||
{ | ||
extension: '.min.js', | ||
plugins: [...baseBundleConfig.plugins, terserPlugin], | ||
}, | ||
].forEach(build => { | ||
builds.push({ | ||
...baseBundleConfig, | ||
output: { | ||
...baseBundleConfig.output, | ||
file: `${baseBundleConfig.output.file}${build.extension}`, | ||
}, | ||
plugins: build.plugins, | ||
}); | ||
}); | ||
return builds; | ||
} | ||
|
||
export default loadAllIntegrations(); | ||
export default makeMinificationVariants(baseBundleConfig); |
Oops, something went wrong.