A webpack loader that executes JavaScript files once in the global context, useful for loading legacy scripts or libraries that pollute the global scope. Current stable version is 0.7.2, last released September 2017. This loader is part of the webpack-contrib organization and has minimal dependencies. It differs from imports-loader or expose-loader by executing scripts directly, without module wrapping. Does not work in Node.js; designed exclusively for browser bundles. The project is effectively in maintenance mode with no recent updates.
npm install script-loaderVerified import paths — ran on the pinned version, not inferred.
Configures script-loader to execute .exec.js files in the global context. Shows installation, webpack config, and a sample script that sets a global variable.
Do not use script-loader in Node.js. If needed, consider node-specific alternatives or dynamic require.
Use script-loader only for scripts that intentionally pollute global scope (e.g., jQuery plugins). Use 'use strict' to prevent accidental globals.
If you need options, consider using 'imports-loader' or 'expose-loader' instead.
Ensure the file path is correct and webpack can resolve it. For inline usage, verify the path after 'script-loader!'.
Load dependencies in the correct order using multiple rules or ensure the global environment includes the needed definitions (e.g., via expose-loader).
No dependency data recorded yet.