VanillaJS (pure JavaScript) plugin starter with Webpack 4 and Babel 7.
git clone -b webpack-4-babel-7 https://github.com/thatisuday/js-plugin-starter.git [dest]
Here,
destis your destination directory in which the boilerplate code will be copied.
- Use
npm installcommand to install dependencies. - Execute command
npm run startto run webpack development server and top open preview in the browser. - Execute command
npm run buildto create plugin distribution files in thedistdirectory. - Tweak configuration inside
configfolder if necessary. - Configure plugin API using this documentation.
- Install React preset using
npm i -D @babel/preset-reactcommand. - Update
babel.config.jsfile with this new preset. Follow these instructions. - Update
/\.js$/with/\.jsx?$/insidewebpack.config.jsto compile JavaScript files with.jsxextensions. - Install React and ReactDOM using
npm i -S react react-domcommand.