requirejs-webpack-plugin
Webpack plugin that update cache for requirejs,replace requirejs urlArgs
base on assets-webpack-plugin
Example:
For example, given the following webpack config:
see ./example/
var path = ;var requirejsPlugin = ; entry: "index":"./src/index.js" output: path:path publicPath:"" filename:"[name].js" plugins: path: path filename: 'main.js' baseUrl : '' pathUrl : '' { return 'require.config(' + JSON + ')' }
The plugin will output the following requirejs config file(./app/main.js):
require
Useage
index.html
......
Install
npm install requirejs-webpack-plugin --save-dev
Options
You can pass the following options:
filename
Optinal. main.js
by default.
Name for the created json file.
filename: 'main.js'
path
Optional. Defaults to the current directory.
Path where to save the file.
path: path
processOutput
Optional. Defaults is JSON stringify function.
Formats the assets output.
{ return 'require.config(' + JSON + ')' }
baseUrl
RequireJS baseUrl config
pathUrl
RequireJS paths config module alias