{"id":20492,"library":"rax-webpack-plugin","title":"rax-webpack-plugin","description":"Webpack plugin for the Rax framework, used to bundle Rax applications with support for multiple target formats (UMD, CMD, bundle, factory). Stable version 0.6.6, with later releases up to v1.2.x in the monorepo. Provides built-in module externalization, polyfill inclusion, and multi-platform output (web, weex, node, React Native). Differentiates from generic webpack plugins by offering Rax-specific features like framework comment injection and duplicate dependency checks. The package is part of the Alibaba Rax project and has a peer dependency on webpack 1–4.","status":"active","version":"0.6.6","language":"javascript","source_language":"en","source_url":"https://github.com/alibaba/rax","tags":["javascript"],"install":[{"cmd":"npm install rax-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add rax-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add rax-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires webpack to function.","package":"webpack","optional":false}],"imports":[{"note":"Plugin does not ship ESM exports; CommonJS require() is required.","wrong":"import RaxPlugin from 'rax-webpack-plugin';","symbol":"RaxPlugin","correct":"const RaxPlugin = require('rax-webpack-plugin');"},{"note":"MultiplePlatform is not exported as default; use destructured require().","wrong":"import { MultiplePlatform } from 'rax-webpack-plugin';","symbol":"MultiplePlatform","correct":"const { MultiplePlatform } = require('rax-webpack-plugin');"},{"note":"BuiltinModules is a property of the plugin constructor, accessible via destructuring.","wrong":"import BuiltinModules from 'rax-webpack-plugin';","symbol":"BuiltinModules","correct":"const { BuiltinModules } = require('rax-webpack-plugin');"}],"quickstart":{"code":"const RaxPlugin = require('rax-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/app.js',\n  output: {\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new RaxPlugin({\n      target: 'umd',\n      moduleName: 'MyApp',\n      globalName: 'MyApp',\n      externalBuiltinModules: true,\n      includePolyfills: false,\n    }),\n  ],\n};","lang":"javascript","description":"Minimal webpack configuration using rax-webpack-plugin with UMD target and external built-in modules."},"warnings":[{"fix":"Use require('rax-webpack-plugin') instead of import.","message":"Plugin does not support ESM imports; must use CommonJS require().","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Access via RaxPlugin.BuiltinModules or destructure const { BuiltinModules } = require('rax-webpack-plugin').","message":"BuiltinModules is a static property on RaxPlugin, not exported as default.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Provide both options when target is 'umd'.","message":"Specifying both moduleName and globalName is required for UMD target; omitting causes runtime errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use webpack 4 or lower, or migrate to alternative plugin.","message":"Peer dependency webpack ^1.x.x || ^2.x.x || ^3.x.x || ^4.x.x; webpack 5 not supported.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const RaxPlugin = require('rax-webpack-plugin');","cause":"Incorrect import: using default ES import on a CJS module.","error":"TypeError: RaxPlugin is not a constructor"},{"fix":"Run npm install --save-dev rax-webpack-plugin and ensure webpack is installed.","cause":"Package not installed or missing peer dependencies.","error":"Cannot find module 'rax-webpack-plugin'"},{"fix":"Instantiate RaxPlugin with valid options object, e.g., new RaxPlugin({ target: 'umd' }).","cause":"Missing required options for RaxPlugin, e.g., target not specified.","error":"Module parse failed: Unexpected token (1:0) when building"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}