{"id":19446,"library":"dojo-webpack-plugin","title":"dojo-webpack-plugin","description":"Webpack plugin for building Dojo 1.x AMD applications with webpack 5. Current stable version is 3.0.9, maintained on GitHub by OpenNTF. Released continuously with bug fixes and security updates. Differentiators: resolves Dojo AMD modules via webpack, supports synchronous and asynchronous require in packed code, embeds a stripped-down Dojo loader at ~1.5KB for runtime require resolution, handles dojo/text, dojo/has, dojo/i18n loaders, and respects loader config (baseUrl, paths, packages, map, aliases). Requires webpack >=5, tapable >=2, webpack-sources >=2. Alternative to using Dojo's own build system with webpack.","status":"active","version":"3.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/OpenNTF/dojo-webpack-plugin","tags":["javascript"],"install":[{"cmd":"npm install dojo-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add dojo-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add dojo-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"webpack >=5.0.0 is a peer dependency required for the plugin to operate","package":"webpack","optional":false},{"reason":"tapable >=2.0 is a peer dependency used for plugin integration","package":"tapable","optional":false},{"reason":"webpack-sources >=2.0 is a peer dependency for source manipulation","package":"webpack-sources","optional":false}],"imports":[{"note":"Default export. Requires ESM or compatible bundler. CommonJS require() works if using strict CommonJS but not recommended.","wrong":"const DojoWebpackPlugin = require('dojo-webpack-plugin')","symbol":"DojoWebpackPlugin","correct":"import DojoWebpackPlugin from 'dojo-webpack-plugin'"},{"note":"CommonJS users must access .default because the package exports ESM default. Without .default, you get the module object.","wrong":"const DojoWebpackPlugin = require('dojo-webpack-plugin')","symbol":"DojoWebpackPlugin","correct":"const DojoWebpackPlugin = require('dojo-webpack-plugin').default"},{"note":"TypeScript type export; not available at runtime. Use type import only.","wrong":"const { Options } = require('dojo-webpack-plugin')","symbol":"DojoWebpackPlugin.Options","correct":"import type { Options } from 'dojo-webpack-plugin'"}],"quickstart":{"code":"// webpack.config.js\nimport DojoWebpackPlugin from 'dojo-webpack-plugin';\n\nexport default {\n  entry: './src/main.js',\n  output: {\n    path: './dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new DojoWebpackPlugin({\n      loaderConfig: {\n        baseUrl: './src',\n        packages: [\n          { name: 'dojo', location: 'node_modules/dojo' },\n          { name: 'app', location: '.' }\n        ],\n        async: true\n      },\n      environment: { dojoConfig: 'path/to/dojoConfig.js' },\n      locales: ['en-us', 'fr']\n    })\n  ],\n  module: {\n    rules: [\n      { test: /\\.html$/, loader: 'raw-loader' }\n    ]\n  }\n};","lang":"typescript","description":"Shows how to configure the plugin in a webpack config with Dojo loader settings including baseUrl, packages, async, locales, and environment."},"warnings":[{"fix":"Upgrade to webpack 5 or use dojo-webpack-plugin@2.x from the v2x branch.","message":"Version 3.0.0 only supports webpack 5. Users on webpack 4 must use the v2x branch.","severity":"breaking","affected_versions":"^3.0.0"},{"fix":"Ensure the Dojo toolkit is installed (npm install dojo) and referenced in loaderConfig.packages.","message":"The plugin embeds a custom build of the Dojo loader at build time; the Dojo source must be resolvable in node_modules or via loaderConfig. Without it, the build may fail with missing module errors.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use import syntax or require('dojo-webpack-plugin').default.","message":"The default export is ESM-only. Using require('dojo-webpack-plugin') without .default returns the module object, not the constructor.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Avoid using this option or handle undefined values explicitly in your code.","message":"The 'coerceUndefinedToFalse' option is deprecated and may be removed in future releases.","severity":"deprecated","affected_versions":"^3.0.0"},{"fix":"Use static require expressions or async require for dynamic module loading.","message":"The plugin uses a stripped-down loader for runtime require calls; synchronous require with non-static expressions may not work as expected.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Review plugin options for webpack 5 compatibility; remove any outdated options.","message":"In v3.0.0, support for webpack 4 was dropped; plugin options related to webpack 4 hooks may be ignored.","severity":"breaking","affected_versions":"^3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install dojo and add { name: 'dojo', location: 'node_modules/dojo' } to loaderConfig.packages.","cause":"Dojo toolkit is not installed or not referenced in loaderConfig.","error":"Module not found: Error: Can't resolve 'dojo'"},{"fix":"Use const DojoWebpackPlugin = require('dojo-webpack-plugin').default;","cause":"Using require() without .default when the package exports ESM default.","error":"TypeError: DojoWebpackPlugin is not a constructor"},{"fix":"Verify Dojo is installed in node_modules/dojo or specify a custom loader path via the 'loader' option in the plugin config.","cause":"The plugin cannot locate the Dojo loader source at build time.","error":"Error: Dojo loader not found. Ensure Dojo is installed or provide 'loader' option."},{"fix":"Upgrade to dojo-webpack-plugin >=3.0.3 which fixes this issue.","cause":"Conflict with mini-css-extract-plugin or other plugins that modify chunk modules.","error":"Cannot read property 'getChunkModules' of undefined","affected_versions":"<=3.0.2"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}