Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copy-loader

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-loader

copy loader module for webpack

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DEPRECATED

Just use file-loader: file?name=[path][name].[ext]&context=./src.

Or, to keep a pretty syntax, add this to your webpack.config.js:

    resolveLoader: { 
        alias: {
            'copy': 'file-loader?name=[path][name].[ext]&context=./src',
        }
    },

So you can just do

    require("copy!somedir/myfile.html");

and src/somedir/myfile.html will get copied to <outputPath>/somedir/myfile.html.

copy loader for webpack

Usage

// in /src/images/index.js

var url = require("copy!./file.png");

// copies file.png to /output/images/file.png
// url = "/images/file.png"

copy-loader copies a file from source to your output path without changing directory structure or filename. This is unlike the file-loader, which hashes the file and forgets the directory structure.

The directory structure is copied from the root directory, which is determined as follows:

  1. From the query-string: e.g. require("copy?src!./file.png")
  2. From copyContext in webpack.config.js
  3. From context in webpack.config.js (defaults to process.cwd(), the current working directory)

Note: You don't have to specify the full path - the directory name itself is sufficient.

License

MIT (http://www.opensource.org/licenses/mit-license.php)

FAQs

Package last updated on 27 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc