Mdx-deck: custom webpack configurations.

Created on 15 Aug 2018  路  4Comments  路  Source: jxnblk/mdx-deck

Currently, cli.js contains setup for webpack.
If someone want to add extra remark mdPlugins or webpack loaders, user may need to modify cli.js manually.

Do you consider to consider options to allow users add extra mdPlugins or webpack loaders?

enhancement

Most helpful comment

I think a good approach is to:

  1. Add a --webpack option to the CLI to point to a custom config
  2. Automatically look for a webpack.config.js from the CLI using find-up as done here in x0
  3. Use webpack-merge to merge with the built-in config, making sure mdx-deck/loader is still used

All 4 comments

Would love this as well, this is necessary for adding typescript support.

For an implementation example, see how https://github.com/pedronauck/docz implemented support for a typescript: true flag in their configuration as well as custom webpack loader options.

Yeah, I'll likely add support for custom webpack.config.js from the CLI and would accept a PR for this

Hey @jxnblk, I'd love to give this a shot. I can see two options for implementing support for custom webpack configs:

  • Automatically use a webpack.config.js file if it exists. Pros: easy to use, very flexible. Cons: Overrides default webpack config fully, so the default config has to be reimplemented & kept up to date.
  • Replicate Next.js' approach: A custom config file that exports a function which receives the default config as an argument and returns the modified config. Pros: No need to reimplement the default config. Cons: less intuitive.

WDYT? Which approach do you prefer or did you have something completely different in mind?

I think a good approach is to:

  1. Add a --webpack option to the CLI to point to a custom config
  2. Automatically look for a webpack.config.js from the CLI using find-up as done here in x0
  3. Use webpack-merge to merge with the built-in config, making sure mdx-deck/loader is still used
Was this page helpful?
0 / 5 - 0 ratings

Related issues

wesbos picture wesbos  路  6Comments

busypeoples picture busypeoples  路  4Comments

sibelius picture sibelius  路  3Comments

busypeoples picture busypeoples  路  5Comments

zz1211 picture zz1211  路  7Comments