This is a webpack plugin that allows you upload generated assets to a SharePoint site. This uses the spsave plugin to authenticate and upload to SharePoint.
Maintainer: Yohan Belval @yohanb
Install the plugin with npm:
$ npm install spsave-webpack-plugin --save-dev
The plugin will upload all your webpack's assets to SharePoint using spsave. Just add the plugin to your webpack config as follows:
var path = require('path');
var SPSaveWebpackPlugin = require('spsave-webpack-plugin');
var root = path.join.bind(path, path.resolve(__dirname));
var webpackConfig = {
entry: './index.js',
output: {
path: root('dist'),
filename: 'bundle.js'
},
plugins: [new SPSaveWebpackPlugin({
"coreOptions": {
"checkin": true,
"checkinType": 1,
"siteUrl": "[your sharepoint site URL]"
},
"credentialOptions": {
/* See https://github.com/s-KaiNet/node-sp-auth#params for authentication options */
},
"fileOptions": {
"folder": "Style Library/dist"
}
})]
};
module.exports = webpackConfig;
This will upload the dist/bundle.js
to the specified folder:
Since the Webpack plugin is based on the spsave node module, all configuration options are
virtually identical. The only difference is the fact that you do not need to specify fileOptions
other that the destination
folder since the uploaded files will be the ones emitted by the Webpack build.
NOTE: This plugin is not intended to be used when in a hot-reloading Webpack setup.
This project is licensed under MIT.