Skip to content

Commit

Permalink
Merge pull request #3175 from projectblacklight/update-rollup-config
Browse files Browse the repository at this point in the history
Update rollup config for version 3
  • Loading branch information
jcoyne authored Oct 8, 2024
2 parents 73361d7 + cc33ad9 commit 88580b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "4.2.0",
"description": "Exhibits plugin for blacklight",
"main": "app/assets/javascripts/spotlight",
"type": "module",
"scripts": {
"prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
},
Expand Down
21 changes: 7 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
'use strict'

import includePaths from 'rollup-plugin-includepaths';

const path = require('path')

const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'

Expand All @@ -19,19 +15,16 @@ let includePathOptions = {
};

const rollupConfig = {
input: path.resolve(__dirname, `app/javascript/spotlight/index.js`),
input: 'app/javascript/spotlight/index.js',
output: {
file: path.resolve(__dirname, `app/assets/javascripts/spotlight/${fileDest}.js`),
format: ESM ? 'esm' : 'umd',
file: `app/assets/javascripts/spotlight/${fileDest}.js`,
format: ESM ? 'es' : 'umd',
globals,
generatedCode: 'es2015'
generatedCode: { preset: 'es2015' },
name: ESM ? undefined : 'Spotlight'
},
external,
plugins: [includePaths(includePathOptions)]
}

if (!ESM) {
rollupConfig.output.name = 'Spotlight'
}
};

module.exports = rollupConfig
export default rollupConfig

0 comments on commit 88580b5

Please sign in to comment.