Skip to content

[6.x] Webpack: Support configs written in non-JavaScript #697

Closed

Description

@G-Rath
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

Webpack supports using config files written in other languages (such as typescript & coffeescript) without the need to compile those files into JS, provided the right tools are installed.

For example, doing webpack will work with webpack.config.ts provided ts-node is installed.

These details are documented (here)[https://webpack.js.org/configuration/configuration-languages/].

It would be great if @eletron-forge/webpack supported this.

Currently, if I have a .ts webpack config, it doesn't get run though ts-node.

An acceptable compromise for me at this point would be to have some of pre-use hook that I could trigger compiling from; for example, being able to pass an npm command like npm run build-configs to compile my configs before they're used.

Activity

  1. malept commented on Feb 15, 2019

    @malept
    Member

    I think right now the workaround is to write a shim script that calls ts-node programmatically with your config file.

    I think this is a good feature for someone to contribute to Forge. It looks like based off of your link, webpack uses node-interpret to determine how to execute the config file?

    I believe this sort of logic would go here:

    https://github.com/electron-userland/electron-forge/blob/788412e38cfb7a0efa7202a39d45e47c78b4118b/packages/plugin/webpack/src/WebpackPlugin.ts#L41-L44

  2. changed the title [-]Webpack: Support multilingual webpack configs (webpack.config.ts)[/-] [+]Webpack: Support webpack configs written in non-JavaScript[/+] on Feb 15, 2019
  3. G-Rath commented on Feb 15, 2019

    @G-Rath
    Author

    I think right now the workaround is to write a shim script that calls ts-node programmatically with your config file.

    Yes, something like that - The thing I'd wanted to avoid is having to do npm run build-configs && electron-forge x everywhere.

    I think this is a good feature for someone to contribute to Forge.

    I was meaning to stick at the end that I'd be interested in having a whack at it if I manage to find some free time, if it sounded like something that could be viable & someone pointed me in the right direction :)

    Thanks for the better title - I'm got a bit going on right now, that's got me frazzled so sorry if some of my sentences don't make a lot of sense 😂

  4. changed the title [-]Webpack: Support webpack configs written in non-JavaScript[/-] [+]Webpack: Support configs written in non-JavaScript[/+] on Feb 15, 2019
  5. changed the title [-]Webpack: Support configs written in non-JavaScript[/-] [+][6.x] Webpack: Support configs written in non-JavaScript[/+] on Feb 21, 2019
  6. thomassuckow commented on Jun 24, 2019

    @thomassuckow

    #905 suggests adding support for returning a function, then at least you could run the parser yourself and return the json.

  7. added
    plugin/webpack
    on Jan 23, 2020
  8. added
    hacktoberfest
    on Sep 30, 2020
  9. self-assigned this
    on Mar 1, 2022
  10. erickzhao commented on Oct 31, 2022

    @erickzhao
    Member

    closed in #3012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhacktoberfesthelp wantedplugin/webpack

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions