question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UMD option for publishing to NPM?

See original GitHub issue

I have been looking at a couple repositories for a neat starter project for publishing a collection of Vue components or a small library for Vue.js.

So far what I’ve seen is that they are either too simplistic or made by people who do not really understand what is going on with Webpack.

This template seems to fit the bill though, having HMR, different Webpack setups per environment, a linter, unit testing, e2e testing, etc.

I was kind of surprised to see there is no way to neatly publish a library with this template though. Is this conscious a choice or has this just never been added?

I would love a Webpack config for publishing to NPM with externals options libraryTarget, etc.

At the moment I am trying to figure this out all on my own so I at least have an understanding of what is going on but this is taking quite some time to figure out. It would be nice to have a community effort for something like this and although I am willing to help, I am no expert on this(yet 😛).

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tinchox5commented, Aug 14, 2017

It would be nice and useful to have an official template for plugins. I think the demand will increase because the vue community is growing and also is maturing. For instance, I’m not a pro dev, but recently I 've realized that I need a clear way to create a plugin in order to share what I have learnt. I will try to use one of the templates you suggested above and see what happens, but maybe it is possible to redistribute some resources to prioritize that. I mean as you told there are core team members thats have already their own templates. It is just a wish, you guys are doing awesome things with Vue

2reactions
LinusBorgcommented, Aug 2, 2017

We are aware that there’s a need for a template for developing components/packages/plugins as opposed to a full app.

This template is meant for the latter. I don’t think it makes sense to try and turn it into a template that can also create plugins/packages, because it’s not just about some webpack options.

Ideally, you don’t use webpack to bundle packages for production, but rollup, because the runtime overhead of webpack increases the size disroportionally for small libs.

Also, ideally you build more than one version for production, at least:

  • UMD version
  • ES module version (for tree shaking in bundlers that support it (rollup, webpack >=2)

As you can see, a proper template for this will work quite a bit differently, so it should be done in a different template alltogether, instead of shoehorning it into this one.

About the question weither we are working on this: Yes and no.

  • Yes, insofar as many of our core team members have set up their own templates for this that are publicly available (see below)
  • No, insofar as for reasons of resources, there currently are no efforts in creating one “official” template from these existing solutions.

Available templates:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and Publish a Universal JavaScript Module - Medium
Universal Module Definition (UMD) is an attempt to offer compatibility with the most popular scripts loaders (AMD and CommonJS). UMD builds are ...
Read more >
umd - npm
Universal Module Definition for use in automated build systems. Latest version: 3.0.3, last published: 5 years ago. Start using umd in your ...
Read more >
Publish an NPM module in two pattern styles - Stack Overflow
I have a package which is compiled to a UMD by Typescript and then converted to global vars by Webpack (We must use...
Read more >
UNPKG
For npm package authors, unpkg relieves the burden of publishing your code to a CDN in addition to the npm registry. All you...
Read more >
How To Publish Your Vue.js Component On NPM | Codementor
How To Publish Your Vue.js Component On NPM ... libraryTarget: 'umd', // These options are useful if the user wants to load the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found