![]() We can address the most common use cases by specifying 2 additional versions ( module and unpkg), and provide access to the. The package.json file used by npm really only requires one version ( main), but as it turns out, we aren’t limited to that. How does npm know which version to serve to a browser/build process? It is likely your own package.json file will contain a lot more than is listed here. The file used in these examples was generated by hand, and will include the minimum configuration required for the discussion/task at hand. Throughout this document, references are made to the package.json file listed above. Properly packaging your SFC for distribution via npm enables your component to be shared in a way which is ready to use everywhere! Packaging Components for npmįor the purposes of this section, assume the following file structure: package.json However, this excludes anyone who wishes to use the component directly in a browser via tag, anyone who uses a runtime-only build, or build processes which don’t understand what to do with. vue file might be preferred in this scenario (see Packaging Components for npm > SSR Usage for details). Browsersync makes it possible to run a local web server and provides the feature of automatically reloading your browser when a change to a file is detected this is incredibly convenient during development and a (not quite as sophisticated) replacement for the webpack hot reloading feature. The following is an example of an HTML page that contains the JavaScript code in a
0 Comments
Leave a Reply. |