I want to write a library based on p5js, so in my Javascript project I have Webpack installed as dev-dependency and I write this in start.js:
import p5 from "p5";
p5.ellipse(0, 0, 100, 100); // Function not found :(
However, no references are found in p5. I was expecting to find references to p5's functions like rect or ellipse or setup, but nothing.
More info
My Webpack config file is:
const path = require('path');
module.exports = {
entry: './start.js',
output: {
filename: 'start.js',
path: path.resolve(__dirname, 'out')
},
module: {
rules: [
/* In order to transpile ES6 */
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
],
}
};
What am I doing wrong?