All Projects → webpack-contrib → Raw Loader

webpack-contrib / Raw Loader

Licence: mit
A loader for webpack that allows importing files as a String

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Raw Loader

Svg Inline Loader
Inline SVG loader with cleaning-up functionality
Stars: ✭ 490 (-38.75%)
Mutual labels:  webpack-loader
Fileb0x
a better customizable tool to embed files in go; also update embedded files remotely without restarting the server
Stars: ✭ 583 (-27.12%)
Mutual labels:  files
Open Shell Book
开源书籍:《Shell 编程范例》,面向操作对象学 Shell!本书作者发布了《360°剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 666 (-16.75%)
Mutual labels:  files
Expose Loader
Expose Loader
Stars: ✭ 531 (-33.62%)
Mutual labels:  webpack-loader
React Svg Loader
A loader for webpack, rollup, babel that loads svg as a React Component
Stars: ✭ 570 (-28.75%)
Mutual labels:  webpack-loader
Wasm Loader
✨ WASM webpack loader
Stars: ✭ 604 (-24.5%)
Mutual labels:  webpack-loader
Json Loader
json loader module for webpack - UNMAINTAINED
Stars: ✭ 431 (-46.12%)
Mutual labels:  webpack-loader
Libaums
Open source library to access USB Mass Storage devices on Android without rooting your device
Stars: ✭ 769 (-3.87%)
Mutual labels:  files
Filemasta
A search application to explore, discover and share online files
Stars: ✭ 571 (-28.62%)
Mutual labels:  files
Bundle Loader
Bundle Loader
Stars: ✭ 666 (-16.75%)
Mutual labels:  webpack-loader
Comlink Loader
Webpack loader to offload modules to Worker threads seamlessly using Comlink.
Stars: ✭ 535 (-33.12%)
Mutual labels:  webpack-loader
Responsive Loader
A webpack loader for responsive images
Stars: ✭ 536 (-33%)
Mutual labels:  webpack-loader
Cache Loader
[DEPRECATED] Caches the result of following loaders on disk
Stars: ✭ 630 (-21.25%)
Mutual labels:  webpack-loader
Imports Loader
Imports Loader
Stars: ✭ 500 (-37.5%)
Mutual labels:  webpack-loader
Uppy
The next open source file uploader for web browsers 🐶
Stars: ✭ 24,829 (+3003.63%)
Mutual labels:  files
Inject Loader
💉📦 A Webpack loader for injecting code into modules via their dependencies.
Stars: ✭ 474 (-40.75%)
Mutual labels:  webpack-loader
Filegator
Powerful Multi-User File Manager
Stars: ✭ 587 (-26.62%)
Mutual labels:  files
Crawler
A high performance web crawler in Elixir.
Stars: ✭ 781 (-2.37%)
Mutual labels:  files
Memacs
What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
Stars: ✭ 711 (-11.12%)
Mutual labels:  files
Chibisafe
Blazing fast file uploader and awesome bunker written in node! 🚀
Stars: ✭ 657 (-17.87%)
Mutual labels:  files

npm node deps tests coverage chat size

raw-loader

DEPREACTED for v5: please consider migrating to asset modules.

A loader for webpack that allows importing files as a String.

Getting Started

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

$ npm install raw-loader --save-dev

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

file.js

import txt from './file.txt';

webpack.config.js

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/i,
        use: 'raw-loader',
      },
    ],
  },
};

And run webpack via your preferred method.

Options

Name Type Default Description
esModule {Boolean} true Uses ES modules syntax

esModule

Type: Boolean Default: true

By default, raw-loader generates JS modules that use the ES modules syntax. There are some cases in which using ES modules is beneficial, like in the case of module concatenation and tree shaking.

You can enable a CommonJS module syntax using:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/i,
        use: [
          {
            loader: 'raw-loader',
            options: {
              esModule: false,
            },
          },
        ],
      },
    ],
  },
};

Examples

Inline

import txt from 'raw-loader!./file.txt';

Beware, if you already define loader(s) for extension(s) in webpack.config.js you should use:

import css from '!!raw-loader!./file.txt'; // Adding `!!` to a request will disable all loaders specified in the configuration

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].