Skip to content

Commit d680695

Browse files
authored
Merge pull request #3353 from projectblacklight/upgrade-rollup
Upgrade rollup to v4
2 parents bcbacc0 + 2a54ac2 commit d680695

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "9.0.0-alpha",
44
"description": "The frontend code and styles for Blacklight",
55
"main": "app/assets/javascripts/blacklight",
6+
"type": "module",
67
"module": "app/assets/javascripts/blacklight/blacklight.esm.js",
78
"scripts": {
89
"prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
@@ -22,7 +23,7 @@
2223
},
2324
"homepage": "https://github.com/projectblacklight/blacklight#readme",
2425
"devDependencies": {
25-
"rollup": "^2.60.0",
26+
"rollup": "^4.24.0",
2627
"rollup-plugin-includepaths": "^0.2.4"
2728
},
2829
"browserslist": [

rollup.config.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
'use strict'
2-
31
import includePaths from 'rollup-plugin-includepaths';
42

5-
const path = require('path')
63

74
const BUNDLE = process.env.BUNDLE === 'true'
85
const ESM = process.env.ESM === 'true'
@@ -19,19 +16,16 @@ let includePathOptions = {
1916
};
2017

2118
const rollupConfig = {
22-
input: path.resolve(__dirname, `app/javascript/blacklight/index.js`),
19+
input: 'app/javascript/blacklight/index.js',
2320
output: {
24-
file: path.resolve(__dirname, `app/assets/javascripts/blacklight/${fileDest}.js`),
25-
format: ESM ? 'esm' : 'umd',
21+
file: `app/assets/javascripts/blacklight/${fileDest}.js`,
22+
format: ESM ? 'es' : 'umd',
2623
globals,
27-
generatedCode: 'es2015'
24+
generatedCode: { preset: 'es2015' },
25+
name: ESM ? undefined : 'Blacklight'
2826
},
2927
external,
3028
plugins: [includePaths(includePathOptions)]
3129
}
3230

33-
if (!ESM) {
34-
rollupConfig.output.name = 'Blacklight'
35-
}
36-
37-
module.exports = rollupConfig
31+
export default rollupConfig

0 commit comments

Comments
 (0)