assets-upload-loader
v1.2.1
Published
A loader for webpack which upload files to server.
Downloads
7
Readme
assets-upload-loader
A loader for webpack which upload files to server.
Getting Started
To begin, you'll need to install assets-upload-loader:
$ npm install assets-upload-loader --save-dev
OR
yarn add -D assets-upload-loader
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|gif)$/i,
use: [
{
loader: 'assets-upload-loader',
options: {
upload: {
url: 'https://example.com/upload',
data: {
token: 'upload token',
to: 'to_dir',
},
},
name: 'assets/[name].[hash:6].[ext]',
},
},
],
},
],
},
};
And run webpack
via your preferred method.