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 custom webpack loader configurations #370

Closed
1 of 5 tasks
hutchgrant opened this issue Jun 14, 2020 · 1 comment · Fixed by #376
Closed
1 of 5 tasks

Support custom webpack loader configurations #370

hutchgrant opened this issue Jun 14, 2020 · 1 comment · Fixed by #376
Assignees
Labels
CLI documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc)

Comments

@hutchgrant
Copy link
Member

hutchgrant commented Jun 14, 2020

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Currently, if a user wants to add their own webpack plugins, they can do so through the greenwood.config.js. But what if a user wants to modify an existing loader? I propose allowing user overrides of webpack loaders. production, development, and common configs. As well as an ability to eject current configs to user's workspace(maybe a separate issue/PR).

Details

Users need to be able to modify webpack configurations for a variety of things. For example, if I want to add rehype plugins to wc-markdown-loader, I would need access to the webpack config so that I can add:

{
        test: /\.md$/,
        loader: 'wc-markdown-loader',
        options: {
          defaultStyle: false,
          shadowRoot: false,
          preset: {
            settings: { commonmark: true, bullet: '*', emphasis: '*', fences: true },
            plugins: [
              require('rehype-slug'),
              require('rehype-autolink-headings')
            ]
          }
        }
      }, 

My Suggestion for accomplishing this is:

  • modify context lifecycle to check for if a webpack config exists
  • modify build/develop tasks to use the compilation.context to decide what webpack config to use
  • add support for custom webpack loaders (as experimental) as we have support custom webpack plugins.

A future idea would be to have a CLI command to eject the configs into the user's project directory.

@thescientist13 thescientist13 changed the title Support custom webpack configurations Support custom webpack loader configurations Jun 17, 2020
@thescientist13 thescientist13 added CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) labels Jun 17, 2020
@thescientist13 thescientist13 added the documentation Greenwood specific docs label Jun 22, 2020
@thescientist13
Copy link
Member

thescientist13 commented Jun 22, 2020

I think this might in theory resolve #46 or #185 ?

@thescientist13 thescientist13 added the invalid This doesn't seem right label Dec 31, 2020
@thescientist13 thescientist13 removed the invalid This doesn't seem right label Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants