Skip to content

Example for building and debugging a pilet and a Piral instance with webpack. 🚀

License

Notifications You must be signed in to change notification settings

piral-samples/piral-webpack-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Piral Logo

Piral Webpack Sample

⚡ These examples show how to use Piral with Webpack, specifically the piral-cli-webpack plugin.

You can visit this demo at webpack.samples.piral.cloud/.

We have two folders.

sample-pilet

Shows how a standard pilet is debugged and build using Webpack.

After scaffolding we installed piral-cli-webpack:

npm i piral-cli-webpack --save-dev

We've updated the start and build npm tasks to use pilet debug-wp and pilet build-wp respectively.

Besides the change of the two commands we also show here how to publish a pilet in one command:

npm run publish

Which just uses the following commands:

 # cleanup first
rm -rf dist
# also remove old tgz files
rm -f *.tgz
# build it (using webpack!)
npm run build
# pack it using the Piral CLI
pilet pack
# publish the last packed file
pilet publish --url https://feed.piral.cloud/api/v1/pilet/empty --api-key is-invalid-anyway

sample-piral-instance

Shows how a Piral instance is debugged and build using Webpack.

After scaffolding we installed piral-cli-webpack. Since the Piral instance also used Sass for the stylesheet we had to install node-sass, too:

npm i piral-cli-webpack node-sass --save-dev

We've updated the start and build npm tasks to use piral debug-wp and piral build-wp respectively.

License

Piral and this sample code is released using the MIT license. For more information see the license file.