Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollup.defineConfig is undefined at runtime. #4133

Closed
tasshi-me opened this issue Jun 7, 2021 · 0 comments · Fixed by #4134
Closed

rollup.defineConfig is undefined at runtime. #4133

tasshi-me opened this issue Jun 7, 2021 · 0 comments · Fixed by #4134

Comments

@tasshi-me
Copy link
Contributor

Hi there, and thanks for the great package.
I encountered following unexpected behavior.

Summary

rollup -c failed when rollup.config.js using rollup.defineConfig,
because rollup.defineConfig is not defined at runtime.

FYI: rollup.defineConfig is added in v2.51.0.

Reproduction

https://github.com/tasshi-playground/repro-rollup-defineConfig-undefined

$ git clone https://github.com/tasshi-playground/repro-rollup-defineConfig-undefined.git
$ cd repro-rollup-defineConfig-undefined
$ npm install
$ npm run build # equal to "rollup -c"

Then, error occur.

Expected Behavior

rollup -c success.

Actual Behavior

rollup -c failed with following error.

[!] TypeError: rollup.defineConfig is not a function
TypeError: rollup.defineConfig is not a function
    at Object.<anonymous> (<project_dir>/rollup.config.js:7:28)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.require.extensions.<computed> [as .js] (<project_dir>/node_modules/rollup/dist/shared/loadConfigFile.js:530:20)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at loadConfigFromBundledFile (<project_dir>/node_modules/rollup/dist/shared/loadConfigFile.js:538:42)
    at getDefaultFromTranspiledConfigFile (<project_dir>/node_modules/rollup/dist/shared/loadConfigFile.js:522:12)
    at async loadConfigFile (<project_dir>/rollup/dist/shared/loadConfigFile.js:487:15)

with Node.js REPL, rollup module does not contain defineConfig.

Welcome to Node.js v14.17.0.
Type ".help" for more information.
> require("rollup")
{
  VERSION: '2.51.0',
  rollup: [Function: rollup],
  watch: [Function: watch]
}

Cause

rollup.defineConfig is defined in type definition but does not exist at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant