p5.EasyCam icon indicating copy to clipboard operation
p5.EasyCam copied to clipboard

written for node_modules

Open unjust opened this issue 5 years ago • 1 comments

I'm currently using webpack imports and exports loader to get this to work. Can this be written with es6 exports ? Maybe as a node_module as well?

unjust avatar Apr 27 '19 19:04 unjust

Just a suggestion

In the meantime I'm doing this with webpack and it seems to work well

        rules: [
            {
                test: path.resolve(__dirname, 'libs/easycam/p5.easycam.js'),
                use: "imports-loader?p5=>require('p5')"
            },
            {
                // https://webpack.js.org/guides/shimming/#global-exports
                test: path.resolve(__dirname, 'libs/easycam/p5.easycam.js'),
                use: 'exports-loader?createEasyCam=p5.prototype.createEasyCam,EasyCamLib=Dw'
            },

then in my animation file

import { createEasyCam, EasyCamLib } from '../libs/easycam/p5.easycam.js';

unjust avatar Apr 28 '19 02:04 unjust