@nativescript/webpack 5.0.31-next.0 → 5.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +100 -0
- package/package.json +19 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright OpenJS Foundation and other contributors, https://openjsf.org
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://nativescript.org">
|
|
3
|
+
<img alt="NativeScript" src="https://raw.githubusercontent.com/NativeScript/artwork/main/logo/export/NativeScript_Logo_Dark_Transparent.png" width="100"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">@nativescript/webpack</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<b>Webpack configuration for NativeScript apps.</b>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/@nativescript/webpack"><img src="https://img.shields.io/npm/v/@nativescript/webpack.svg" alt="npm version"></a>
|
|
15
|
+
<a href="https://github.com/NativeScript/NativeScript/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@nativescript/webpack"><img src="https://img.shields.io/npm/dm/@nativescript/webpack.svg" alt="downloads"></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://docs.nativescript.org/configuration/webpack">Documentation</a> ·
|
|
21
|
+
<a href="https://docs.nativescript.org/setup/">Environment Setup</a> ·
|
|
22
|
+
<a href="https://github.com/NativeScript/NativeScript/blob/main/tools/notes/CONTRIBUTING.md">Contribute</a> ·
|
|
23
|
+
<a href="https://nativescript.org/discord">Community</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
All NativeScript applications are bundled using webpack. This package provides the required configuration to build NativeScript apps with flexibility to customize as needed.
|
|
29
|
+
|
|
30
|
+
## 📦 Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @nativescript/webpack --save-dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 🚀 Quick Start
|
|
37
|
+
|
|
38
|
+
All new projects come with a base `webpack.config.js` that's pre-configured:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const webpack = require('@nativescript/webpack')
|
|
42
|
+
|
|
43
|
+
module.exports = (env) => {
|
|
44
|
+
webpack.init(env)
|
|
45
|
+
|
|
46
|
+
// Learn how to customize:
|
|
47
|
+
// https://docs.nativescript.org/webpack
|
|
48
|
+
|
|
49
|
+
return webpack.resolveConfig()
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## ✨ Features
|
|
54
|
+
|
|
55
|
+
- **Auto-discovery**: Automatically detects your project type (TypeScript, Angular, Vue, React, Svelte)
|
|
56
|
+
- **Hot Module Replacement**: HMR enabled by default for faster development
|
|
57
|
+
- **DotEnv Support**: Built-in support for `.env` files to manage environment variables
|
|
58
|
+
- **Bundle Analysis**: Generate bundle reports with `--env.report`
|
|
59
|
+
- **Production Optimization**: Minification with Terser in production mode
|
|
60
|
+
|
|
61
|
+
## 🔧 Global Variables
|
|
62
|
+
|
|
63
|
+
Useful globally available variables in your app:
|
|
64
|
+
|
|
65
|
+
| Variable | Description |
|
|
66
|
+
|----------|-------------|
|
|
67
|
+
| `__DEV__` | `true` when building in development mode |
|
|
68
|
+
| `global.isAndroid` / `__ANDROID__` | `true` when platform is Android |
|
|
69
|
+
| `global.isIOS` / `__IOS__` | `true` when platform is iOS |
|
|
70
|
+
| `global.isVisionOS` / `__VISIONOS__` | `true` when platform is visionOS |
|
|
71
|
+
| `global.__APPLE__` | `true` when platform is iOS or visionOS |
|
|
72
|
+
|
|
73
|
+
## 📚 API
|
|
74
|
+
|
|
75
|
+
### Core Methods
|
|
76
|
+
|
|
77
|
+
| Method | Description |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `webpack.init(env)` | Initialize the internal env object (required) |
|
|
80
|
+
| `webpack.chainWebpack(chainFn)` | Add chain functions to modify config |
|
|
81
|
+
| `webpack.mergeWebpack(obj)` | Merge objects into the final config |
|
|
82
|
+
| `webpack.resolveConfig()` | Resolve the final webpack configuration |
|
|
83
|
+
|
|
84
|
+
## 🎛️ CLI Flags
|
|
85
|
+
|
|
86
|
+
| Flag | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| `--no-hmr` | Disable Hot Module Replacement |
|
|
89
|
+
| `--env.production` | Enable production mode with minification |
|
|
90
|
+
| `--env.report` | Generate bundle analysis report |
|
|
91
|
+
| `--env.verbose` | Print verbose logs and internal config |
|
|
92
|
+
| `--env.e2e` | Enable E2E mode (enables `testID` property) |
|
|
93
|
+
|
|
94
|
+
## 📖 Documentation
|
|
95
|
+
|
|
96
|
+
For complete documentation including configuration examples, visit the [webpack configuration guide](https://docs.nativescript.org/configuration/webpack).
|
|
97
|
+
|
|
98
|
+
## 📄 License
|
|
99
|
+
|
|
100
|
+
[MIT licensed](https://github.com/NativeScript/NativeScript/blob/main/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript/webpack",
|
|
3
|
-
"version": "5.0.31
|
|
3
|
+
"version": "5.0.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -85,7 +85,21 @@
|
|
|
85
85
|
"url": "https://github.com/NativeScript/NativeScript"
|
|
86
86
|
},
|
|
87
87
|
"author": {
|
|
88
|
-
"name": "
|
|
89
|
-
"email": "
|
|
90
|
-
}
|
|
91
|
-
|
|
88
|
+
"name": "Igor Randjelovic",
|
|
89
|
+
"email": "rigor789@gmail.com"
|
|
90
|
+
},
|
|
91
|
+
"contributors": [
|
|
92
|
+
{
|
|
93
|
+
"name": "NativeScript",
|
|
94
|
+
"email": "oss@nativescript.org"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"keywords": [
|
|
98
|
+
"NativeScript",
|
|
99
|
+
"JavaScript",
|
|
100
|
+
"Android",
|
|
101
|
+
"iOS",
|
|
102
|
+
"TypeScript",
|
|
103
|
+
"webpack"
|
|
104
|
+
]
|
|
105
|
+
}
|