All Projects → webpack-contrib → Source Map Loader

webpack-contrib / Source Map Loader

Licence: mit
extract sourceMappingURL comments from modules and offer it to webpack

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Source Map Loader

nunjucks-loader
Webpack loader for Nunjucks templates
Stars: ✭ 20 (-93.2%)
Mutual labels:  webpack-loader
ts-interface-loader
Webpack support for validating TypeScript definitions at runtime.
Stars: ✭ 19 (-93.54%)
Mutual labels:  webpack-loader
sass-to-string
webpack loader that transform your SCSS file in a javascript string
Stars: ✭ 17 (-94.22%)
Mutual labels:  webpack-loader
vue-template-compiler-loader
Webpack loader to pre-compile Vue 2.0 templates
Stars: ✭ 26 (-91.16%)
Mutual labels:  webpack-loader
slim-lang-loader
Webpack loader: slim => html => javascript
Stars: ✭ 20 (-93.2%)
Mutual labels:  webpack-loader
scalajs-webpack-loader
Webpack loader for Scala.js
Stars: ✭ 24 (-91.84%)
Mutual labels:  webpack-loader
graphql-raw-loader
🍖 With Webpack, loads GraphQL files as raw strings and handle it's import directive & comment statement.
Stars: ✭ 19 (-93.54%)
Mutual labels:  webpack-loader
Ts Loader
TypeScript loader for webpack
Stars: ✭ 3,112 (+958.5%)
Mutual labels:  webpack-loader
exif-loader
Extract EXIF- & IPTC-data from your JPGs during build-time.
Stars: ✭ 14 (-95.24%)
Mutual labels:  webpack-loader
typed-css-modules-loader
💠 Webpack loader for typed-css-modules auto-creation
Stars: ✭ 62 (-78.91%)
Mutual labels:  webpack-loader
mjml-loader
MJML loader for webpack
Stars: ✭ 27 (-90.82%)
Mutual labels:  webpack-loader
yaml-frontmatter-loader
[DEPRECATED] Yaml frontmatter loader
Stars: ✭ 12 (-95.92%)
Mutual labels:  webpack-loader
stylos
Webpack plugin to automatically generate and inject CSS utilities to your application
Stars: ✭ 60 (-79.59%)
Mutual labels:  webpack-loader
React-bookstore
Bookstore using google-book Apis made with reactjs🔥🚀
Stars: ✭ 14 (-95.24%)
Mutual labels:  webpack-loader
React Proxy Loader
Wraps a react component in a proxy component to enable Code Splitting.
Stars: ✭ 258 (-12.24%)
Mutual labels:  webpack-loader
graphql-loader
🍒 A webpack loader for .graphql documents
Stars: ✭ 60 (-79.59%)
Mutual labels:  webpack-loader
Webpack-4-boilerplate
🚀 Webpack 4 with ES6+ and SASS,LESS/STYLUS support + dev-server and livereload
Stars: ✭ 55 (-81.29%)
Mutual labels:  webpack-loader
Graphql Let
A layer to start/scale the use of GraphQL code generator.
Stars: ✭ 282 (-4.08%)
Mutual labels:  webpack-loader
Istanbul Instrumenter Loader
Istanbul Instrumenter Loader
Stars: ✭ 272 (-7.48%)
Mutual labels:  webpack-loader
web-components-loader
Webpack loader that makes it incredibly easy to import HTML-centric Web Components into your project.
Stars: ✭ 34 (-88.44%)
Mutual labels:  webpack-loader

npm node deps tests coverage chat size

source-map-loader

Extracts source maps from existing source files (from their sourceMappingURL).

Getting Started

To begin, you'll need to install source-map-loader:

npm i -D source-map-loader

Then add the plugin to your webpack config. For example:

file.js

import css from "file.css";

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        enforce: "pre",
        use: ["source-map-loader"],
      },
    ],
  },
};

The source-map-loader extracts existing source maps from all JavaScript entries. This includes both inline source maps as well as those linked via URL. All source map data is passed to webpack for processing as per a chosen source map style specified by the devtool option in webpack.config.js. This loader is especially useful when using 3rd-party libraries having their own source maps. If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data. source-map-loader allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved. The source-map-loader will extract from any JavaScript file, including those in the node_modules directory. Be mindful in setting include and exclude rule conditions to maximize bundling performance.

And run webpack via your preferred method.

Options

Name Type Default Description
filterSourceMappingUrl {Function} undefined Allows to control SourceMappingURL behaviour

filterSourceMappingUrl

Type: Function Default: undefined

Allows you to specify the behavior of the loader for SourceMappingURL comment.

The function must return one of the values:

  • true or 'consume' - consume the source map and remove SourceMappingURL comment (default behavior)
  • false or 'remove' - do not consume the source map and remove SourceMappingURL comment
  • skip - do not consume the source map and do not remove SourceMappingURL comment

Example configuration:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        enforce: "pre",
        use: [
          {
            loader: "source-map-loader",
            options: {
              filterSourceMappingUrl: (url, resourcePath) => {
                if (/broker-source-map-url\.js$/i.test(url)) {
                  return false;
                }

                if (/keep-source-mapping-url\.js$/i.test(resourcePath)) {
                  return "skip";
                }

                return true;
              },
            },
          },
        ],
      },
    ],
  },
};

Examples

Ignoring Warnings

To ignore warnings, you can use the following configuration:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        enforce: "pre",
        use: ["source-map-loader"],
      },
    ],
  },
  ignoreWarnings: [/Failed to parse source map/],
};

More information about the ignoreWarnings option can be found here

Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.

CONTRIBUTING

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].