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

Generate multiple targets with webpack #359

Merged
merged 1 commit into from Mar 17, 2020
Merged

Generate multiple targets with webpack #359

merged 1 commit into from Mar 17, 2020

Conversation

danielfdickinson
Copy link

Generate prod (minified), dev (inline sourcemap), and 'raw' (mode: none)
versions of the library in the 'dist' folder. This closes #346 although
for backwards compatibility the minified version is 'fuse.js', the dev
version is 'fuse.dev.js', and the unminified version with external
sourcemap is 'fuse.raw.js'.

Signed-off-by: Daniel F. Dickinson cshored@thecshore.com

Copy link
Owner

@krisk krisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just one comment.

@@ -32,6 +32,3 @@ jobs:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: yarn --frozen-lockfile
- run: yarn publish
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you exclude this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yep. Pushing to my fork complains on that (and CI fails) because I'm not you. I'll put it back for your tree.

Generate prod (minified), dev (inline sourcemap), and 'raw' (mode: none)
versions of the library in the 'dist' folder. This closes #346 although
for backwards compatibility the minified version is 'fuse.js', the dev
version is 'fuse.dev.js', and the unminified version with external
sourcemap is 'fuse.raw.js'.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
@krisk krisk merged commit 0fe98b5 into krisk:master Mar 17, 2020
@danielfdickinson danielfdickinson deleted the pr-webpack-multi branch March 17, 2020 05:17
@obihill
Copy link

obihill commented Mar 17, 2020

@cshoredaniel @krisk Thanks for this. I imagine that fuse.dev.js when minified [without any additional enhancements] becomes fuse.js?

@danielfdickinson
Copy link
Author

@obihill Actually if you minify fuse.raw.js with webpack using "mode: production" and

  optimization: {
    minimizer: [new TerserPlugin({
      extractComments: false
    })]

you would get fuse.js (the minified version).

fuse.dev.js is built with webpack's development mode stuff so might not be quite the same.

fuse.raw.js is build with "mode: none" and no optimizations so that there is no webpack special treatment (beyond the transpilation and turning into a umd module).

HTH

@obihill
Copy link

obihill commented Mar 18, 2020

@cshoredaniel Thanks, but I'm not using - nor am I familiar with - Webpack. I was looking for an un-minified version to add to my gulp pipeline. I'm using this to power search for a webapp, and what I do is concatenate all the required libraries, and then minify at the end of the build process.

I didn't see reason in further minifying the minified version, so I posted the issue as I couldn't find an un-minified version. I guess this means I can use fuse.raw.js in my build pipeline?

@danielfdickinson
Copy link
Author

@obihill Ah, yes you would use fuse.raw.js in your build pipeline although I've learned that UMD modules (even unminified) aren't ideal for minifying which is one of the reasons I'll be working exposing a native es6 module.

I misunderstood your question to mean you wanted to know how to reproduce fuse.js (the minified version) from the unminified version.

@obihill
Copy link

obihill commented Mar 19, 2020

@cshoredaniel I'm somewhat old-school with JS, and quite happy with ES5 UMD modules actually. Most of the libraries I have integrated in the webapp I'm working on have un-minified and minified versions on their repos, so I just grab the un-minified versions and put them in the pipeline. I was just looking for the same thing here. It seems to be convention to include uncomplicated un-minified versions, especially for those who do not use webpack, but that appears to be changing of late.

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

Successfully merging this pull request may close these issues.

Un-minified version in distribution
3 participants