babel-plugin-static
v0.2.0
Published
babel plugin to replace static file path.
Downloads
9
Readme
babel-plugin-static
babel plugin to replace static file path.
Example
/* .babelrc */
{
"plugins": [
[ "static", {
"assetsMapFile": "./config/webpack-assets.json",
"assetsKey": "assets"
}]
]
}
/* config/webpack-assets.json */
{
"assets": {
"./images/img.png": "http://cdn.example.com/path/to/img"
}
}
// src/main.js
const img = require('../images/img.png');
will build to:
// dist/main.js (builded)
const img = require('../config/webpack-assets.json').assert['./images/img.png'];
Install
npm i babel-plugin-static -D
Usage
You can dump by using webpack-isomorphic-tools.