easy-webpack / core

An easy way to create configuration files for Webpack
MIT License
68 stars 6 forks source link

Feature Request: presets for libraries #10

Closed mike-morr closed 7 years ago

mike-morr commented 7 years ago

config-library-amd(namedExport?: "lodash") if left blank the module would not have a named export config-library-umd(namedExport?: "lodash") if left blank the module would not have a named export config-library-commonjs() config-library-system() config-library-var(globalVar: "lodash" ) if left blank would need to throw or set a default like "mylib"

See the webpack documentation for more info, but you probably have the docs memorized at this point lol.

I know this is trivial to do now with easy-webpack using the object merging, but it would be nice to have it available with just a quick download of a preset.. It would save a trip to the docs. Especially if the parameters were typed, so intellisense/code-completion would show what the presets are expecting.

Please consider.

┆Issue is synchronized with this Asana task

mike-morr commented 7 years ago

Just realized it might be easier to implement as one preset:

config-output-library({target: "umd", namedExport: "lodash"})

I would be fine with either one. I do think making them separate would help with discoverability, but there are pros and cons to doing it both ways.

niieani commented 7 years ago

Makes sense. Would you be interested in maintaining this package if I create the initial repo?

mike-morr commented 7 years ago

I'll maintain that piece.

mike-morr commented 7 years ago

config-output-library

@niieani I feel like it could be simplified greatly. I felt it was important to notify the user on invalid input so I am throwing exceptions and using console.warn. I could not find an example in the other projects I looked at on how to handle invalid input.

Definitely looking for any advice on simplifying it as a learning exercise. I am not a huge fan of switch, but it appeared to be the best tool for the job. Still new to Open Source, and my TS/JS skills are not master level yet. :) Any feedback you have would be greatly appreciated.

Tests are all passing on my end. I added cross-env as seen in the package.json for the test and build scripts. This enables Windows developers to contribute, mainly me.

Thoughts?

niieani commented 7 years ago

Looks very thorough! Fantastic job, @mike-morrison. I've forked config-output-library to easy-webpack and gave you permission to the fork.

I'll publish this today.

niieani commented 7 years ago

One note, please use the AngularJS Commit Message Conventions in the future commits. Also we don't need version field set in GitHub since it's set by the CI runner. More info on both things here.

niieani commented 7 years ago

@mike-morrison Published!