Skip to content

Commit

Permalink
also expose commonjs prebid module
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuwalow committed May 6, 2024
1 parent 138cc94 commit afdbfe6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
18 changes: 16 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"./prebid": {
"types": "./dist/index.d.ts",
"require": "./dist/prebid.cjs"
"require": "./dist/prebid.cjs",
"import": "./dist/prebid.mjs"
},
"./package.json": "./package.json"
},
Expand All @@ -45,8 +46,8 @@
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"test:it:browserstack": "npm run build-test-resources && wdio test-config/wdio.browserstack.conf.js",
"test:it:local-chrome": "npm run build-test-resources && wdio test-config/wdio.local-chrome.conf.js",
"build": "rollup -c rollup/dist.config.js",
"build-test-resources": "rollup -c rollup/test-resources.config.js",
"build": "rollup --failAfterWarnings -c rollup/dist.config.js",
"build-test-resources": "rollup --failAfterWarnings -c rollup/test-resources.config.js",
"lint": "eslint 'src/**/*.ts' 'test/**/*.ts'",
"fix-js": "eslint --fix 'src/**/*.ts' 'test/**/*.ts' || exit 0",
"release:ci:prepatch": "release-it patch --preRelease=alpha-$(git rev-parse --short HEAD) --ci",
Expand All @@ -66,7 +67,7 @@
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/runtime-corejs3": "^7.24.0",
"@babel/runtime-corejs3": "^7.24.5",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-node-resolve": "^15.2.1",
Expand Down
21 changes: 14 additions & 7 deletions rollup/dist.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const prebid = {
input: "./src/index.ts",
tsOutput: `${OUTPUT_DIR}/prebid.ts.mjs`,
babelOutput: `${OUTPUT_DIR}/prebid.babel.mjs`,
output: `${OUTPUT_DIR}/prebid.cjs`
output: (ext) => `${OUTPUT_DIR}/prebid.${ext}`
}

export default [
Expand All @@ -32,7 +32,7 @@ export default [
dir: OUTPUT_DIR,
entryFileNames: '[name].mjs',
chunkFileNames: '[name]-[hash].mjs',
format: 'es',
format: 'esm',
sourcemap: false
}
],
Expand Down Expand Up @@ -90,11 +90,18 @@ export default [
// minify and bundle
{
input: prebid.babelOutput,
output: {
file: prebid.output,
format: 'cjs',
sourcemap: false
},
output: [
{
file: prebid.output('cjs'),
format: 'cjs',
sourcemap: false
},
{
file: prebid.output('mjs'),
format: 'esm',
sourcemap: false
}
],
plugins: [
commonJs({ sourceMap: false }),
resolve(),
Expand Down

0 comments on commit afdbfe6

Please sign in to comment.