Skip to content

Commit

Permalink
fix: export rollup.defineConfig at runtime (#4134)
Browse files Browse the repository at this point in the history
* fix: export `rollup.defineConfig` at Node.js runtime

* fix: export `rollup.defineConfig` at browser runtime

* test: add test of `rollup.defineConfig` (cjs, mjs)

* Also use bootstrap for coverage build

Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
  • Loading branch information
tasshi-me and lukastaegert committed Jun 8, 2021
1 parent 526b97e commit f46b80a
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -15,7 +15,7 @@
"ci:lint": "npm run lint:nofix",
"ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all",
"ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",
"ci:coverage": "npm run build:cjs && nyc --reporter lcovonly mocha",
"ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha",
"lint": "npx eslint . --fix --cache && npm run lint:markdown",
"lint:nofix": "npx eslint . && npm run lint:markdown",
"lint:markdown": "markdownlint --config markdownlint.json docs/**/*.md",
Expand Down
2 changes: 1 addition & 1 deletion src/browser-entry.ts
@@ -1,2 +1,2 @@
export { default as rollup } from './rollup/rollup';
export { default as rollup, defineConfig } from './rollup/rollup';
export { version as VERSION } from 'package.json';
2 changes: 1 addition & 1 deletion src/node-entry.ts
@@ -1,3 +1,3 @@
export { default as rollup } from './rollup/rollup';
export { default as rollup, defineConfig } from './rollup/rollup';
export { default as watch } from './watch/watch-proxy';
export { version as VERSION } from 'package.json';
5 changes: 5 additions & 0 deletions test/cli/samples/config-defineConfig-cjs/_config.js
@@ -0,0 +1,5 @@
module.exports = {
description: 'uses cjs config file which return config wrapped by defineConfig',
command: 'rollup --config rollup.config.js',
execute: true
};
1 change: 1 addition & 0 deletions test/cli/samples/config-defineConfig-cjs/main.js
@@ -0,0 +1 @@
module.exports = 42;
8 changes: 8 additions & 0 deletions test/cli/samples/config-defineConfig-cjs/rollup.config.js
@@ -0,0 +1,8 @@
const { defineConfig } = require("../../../../dist/rollup");

module.exports = defineConfig({
input: 'main.js',
output: {
format: 'cjs'
},
});
6 changes: 6 additions & 0 deletions test/cli/samples/config-defineConfig-mjs/_config.js
@@ -0,0 +1,6 @@
module.exports = {
description: 'uses mjs config file which return config wrapped by defineConfig',
command: 'rollup --config rollup.config.mjs',
minNodeVersion: 13,
execute: true
};
1 change: 1 addition & 0 deletions test/cli/samples/config-defineConfig-mjs/main.js
@@ -0,0 +1 @@
module.exports = 42;
8 changes: 8 additions & 0 deletions test/cli/samples/config-defineConfig-mjs/rollup.config.mjs
@@ -0,0 +1,8 @@
import { defineConfig } from "../../../../dist/es/rollup.js"

export default defineConfig({
input: 'main.js',
output: {
format: 'cjs'
},
});

0 comments on commit f46b80a

Please sign in to comment.