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

Support different configuration languages #2879

Closed
k2snowman69 opened this issue May 28, 2019 · 7 comments
Closed

Support different configuration languages #2879

k2snowman69 opened this issue May 28, 2019 · 7 comments

Comments

@k2snowman69
Copy link

Feature Use Case

Supporting other configuration languages can improve developer flow. For example, implementing a typescript configuration flow will allow for static typing of the config itself and provide inline errors in VSCode and other editors before the developer even runs the build.

Feature Proposal

Implement something similar to Webpack's supported configuration languages. Based on the documentation they are using interpret to translate the configs from all the other languages back into javascript.

@waynevanson
Copy link

This would be super useful. In a typescript example, all the developer would have to do is ensure they had something like ts-node installed in the package or on their system. Webpack does this by default.

@shellscape
Copy link
Contributor

Hey folks. This is a saved-form message, but rest assured we mean every word. The Rollup team is attempting to clean up the Issues backlog in the hopes that the active and still-needed, still-relevant issues bubble up to the surface. With that, we're closing issues that have been open for an eon or two, and have gone stale like pirate hard-tack without activity.

We really appreciate the folks have taken the time to open and comment on this issue. Please don't confuse this closure with us not caring or dismissing your issue, feature request, discussion, or report. The issue will still be here, just in a closed state. If the issue pertains to a bug, please re-test for the bug on the latest version of Rollup and if present, please tag @shellscape and request a re-open, and we'll be happy to oblige.

@nmccready
Copy link

@shellscape re-open

@thien-do
Copy link

thien-do commented May 9, 2020

an editor-only work-around: https://stackoverflow.com/a/57330838

/** @type {import('rollup').RollupOptions} */
const options = {
  ...
};

export default options;

Some repositories do have the rollup.config.ts file at the moment (for example) but I don't see any typing in the file.

@seivan
Copy link

seivan commented Jun 6, 2020

So there are few ways around this.
One is to use the Rollup script API
and load it using

        "r:script": "ts-node rollup.config.ts",

where tsconfig.json has a

    "ts-node": {
        "compilerOptions": {
            "module": "CommonJS",
            "target": "ES5",
            "esModuleInterop": true,
            "importHelpers": true,
            "resolveJsonModule": true,
            "noImplicitAny": false, // Needed for plugins
            "noImplicitReturns": false, // Fix later
        }
    },

The other approach is to make a rollup.config.js that refers to rollup.config.ts

require('ts-node').register({
    compilerOptions: {

        module: "CommonJS",
        target: "ES5",
        esModuleInterop: true,
        importHelpers: true,
        resolveJsonModule: true,
        noImplicitAny: false, // Needed for plugins
        noImplicitReturns: false, // Fix later



    },

    // and other tsconfig.json options as you like
});

module.exports = require('./rollup.config.ts');

I wish there was to use the ts-node without being forced to Rollup programatically.

@seivan
Copy link

seivan commented Jun 6, 2020

Some repositories do have the rollup.config.ts file at the moment (for example) but I don't see any typing in the file.

@dvkndn
That's because it's a lie, it's just named ts for "consistency"... whatever the hell that means.

@sidvishnoi
Copy link

ICYMI: #3835

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

No branches or pull requests

7 participants