Socket
Book a DemoInstallSign in
Socket

@nativescript/webpack

Package Overview
Dependencies
Maintainers
2
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nativescript/webpack

Source
npmnpm
Version
5.0.31-next.1
Version published
Weekly downloads
2.8K
-17.52%
Maintainers
2
Weekly downloads
 
Created
Source

NativeScript

@nativescript/webpack

Webpack configuration for NativeScript apps.

npm version license downloads

Documentation · Environment Setup · Contribute · Community

All NativeScript applications are bundled using webpack. This package provides the required configuration to build NativeScript apps with flexibility to customize as needed.

📦 Installation

npm install @nativescript/webpack --save-dev

🚀 Quick Start

All new projects come with a base webpack.config.js that's pre-configured:

const webpack = require('@nativescript/webpack')

module.exports = (env) => {
  webpack.init(env)

  // Learn how to customize:
  // https://docs.nativescript.org/webpack

  return webpack.resolveConfig()
}

✨ Features

  • Auto-discovery: Automatically detects your project type (TypeScript, Angular, Vue, React, Svelte)
  • Hot Module Replacement: HMR enabled by default for faster development
  • DotEnv Support: Built-in support for .env files to manage environment variables
  • Bundle Analysis: Generate bundle reports with --env.report
  • Production Optimization: Minification with Terser in production mode

🔧 Global Variables

Useful globally available variables in your app:

VariableDescription
__DEV__true when building in development mode
global.isAndroid / __ANDROID__true when platform is Android
global.isIOS / __IOS__true when platform is iOS
global.isVisionOS / __VISIONOS__true when platform is visionOS
global.__APPLE__true when platform is iOS or visionOS

📚 API

Core Methods

MethodDescription
webpack.init(env)Initialize the internal env object (required)
webpack.chainWebpack(chainFn)Add chain functions to modify config
webpack.mergeWebpack(obj)Merge objects into the final config
webpack.resolveConfig()Resolve the final webpack configuration

🎛️ CLI Flags

FlagDescription
--no-hmrDisable Hot Module Replacement
--env.productionEnable production mode with minification
--env.reportGenerate bundle analysis report
--env.verbosePrint verbose logs and internal config
--env.e2eEnable E2E mode (enables testID property)

📖 Documentation

For complete documentation including configuration examples, visit the webpack configuration guide.

📄 License

MIT licensed.

FAQs

Package last updated on 06 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts