1 |
|
2 | Copyright 2017-present Sonatype, Inc.
|
3 |
|
4 | Licensed under the Apache License, Version 2.0 (the "License");
|
5 | you may not use this file except in compliance with the License.
|
6 | You may obtain a copy of the License at
|
7 |
|
8 | http://www.apache.org/licenses/LICENSE-2.0
|
9 |
|
10 | Unless required by applicable law or agreed to in writing, software
|
11 | distributed under the License is distributed on an "AS IS" BASIS,
|
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | See the License for the specific language governing permissions and
|
14 | limitations under the License.
|
15 | -->
|
16 | # Copy Modules Plugin
|
17 |
|
18 | # Table Of Contents
|
19 | * [Introduction](#introduction)
|
20 | * [Installation](#installation)
|
21 | * [Usage](#usage)
|
22 | * [Configuration](#configuration)
|
23 | * [The Fine Print](#the-fine-print)
|
24 | * [Getting help](#getting-help)
|
25 |
|
26 | ## Introduction
|
27 |
|
28 | `copy-modules-webpack-plugin` is a Webpack plugin which copies all of the source files which go into the webpack
|
29 | bundle(s) to a separate directory. This enables external tools such as Sonatype Nexus Lifecycle to analyze only those
|
30 | source files which will be included in the final bundle.
|
31 |
|
32 | ### N.B. Since version 2.0 the plugin is only compatible with webpack 4.0 and later. Use 1.x releases for webpack 3.
|
33 |
|
34 | ## Installation
|
35 |
|
36 | ```
|
37 | npm install --save-dev copy-modules-webpack-plugin
|
38 | ```
|
39 |
|
40 | ## Usage
|
41 |
|
42 | Instantiate the plugin with the desired configuration options and include it in the `plugins` array of your webpack configuration:
|
43 |
|
44 | ```
|
45 | const CopyModulesPlugin = require("copy-modules-webpack-plugin");
|
46 |
|
47 | module.exports = {
|
48 | ...
|
49 | plugins: [
|
50 | new CopyModulesPlugin({
|
51 | destination: 'webpack-modules'
|
52 | })
|
53 | ]
|
54 | }
|
55 | ```
|
56 |
|
57 | ### Configuration
|
58 |
|
59 | `copy-modules-webpack-plugin` currently supports the following configuration options:
|
60 |
|
61 | <dl>
|
62 | <dt>destination</dt>
|
63 | <dd>
|
64 | The destination directory where the modules will be copied.
|
65 | </dd>
|
66 | <dt>includePackageJsons</dt>
|
67 | <dd>
|
68 | <p>
|
69 | When using Webpack 4, set this to true to also copy the package.json file associated with each copied module
|
70 | file. This may be useful if you are analyzing the output with a tool that has need for additional metadata about
|
71 | each module (Default: false).
|
72 | </p>
|
73 | <p>
|
74 | Note: when using webpack 5, the package.json files are copied regardless of the value of this flag.
|
75 | </p>
|
76 | </dd>
|
77 | </dl>
|
78 |
|
79 | ## The Fine Print
|
80 |
|
81 | It is worth noting that this is **NOT SUPPORTED** by Sonatype, and is a contribution of ours
|
82 | to the open source community (read: you!)
|
83 |
|
84 | Remember:
|
85 |
|
86 | * Use this contribution at the risk tolerance that you have
|
87 | * Do NOT file Sonatype support tickets related to Webpack support
|
88 | * DO file issues here on GitHub, so that the community can pitch in
|
89 |
|
90 | Phew, that was easier than I thought. Last but not least of all:
|
91 |
|
92 | Have fun creating and using this plugin, we are glad to have you here!
|
93 |
|
94 | ## Getting help
|
95 |
|
96 | Looking to contribute to our code but need some help? There's a few ways to get information:
|
97 |
|
98 | * Chat with us on [Gitter](https://gitter.im/sonatype/nexus-developers)
|
99 | * Connect with [@sonatypeDev](https://twitter.com/sonatypedev) on Twitter
|