image-js / stroke-width-transform

BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Does it work in browser or just on node? #2

Open cosmo-naut opened 6 years ago

JeffersonH44 commented 6 years ago

It should work on the browser @cosmo-naut

cosmo-naut commented 6 years ago

Is there any specific way I need to import it in conjunction with ccv?

JeffersonH44 commented 6 years ago

this is a reduced version of the ccv in order to reduce the size of the source files, I have a plan to release other algorithms on separated packages

cosmo-naut commented 6 years ago

So I would want to include src/LoadSWT.js as well as ccv/js/ccv.js?

JeffersonH44 commented 6 years ago

no, just the LoadSWT should do the work...

cosmo-naut commented 6 years ago

What about the ml-matrix dependency of that file? Sorry to bother you, your help is greatly appreciated

JeffersonH44 commented 6 years ago

I guess that you are able to browserify and it gets all the dependencies, otherwise I will try it and tell you later

cosmo-naut commented 6 years ago

I am having an error being unable to find the distribution folder ../dist/ccv It is present nowhere in the git repo

JeffersonH44 commented 6 years ago

are you using npm? or you are using only the repo, if you are using the repo you have to compile it (download the repo with it's submodules) and compile it, to have those folder, also you can run the test to check if it's ok (npm run test)

JeffersonH44 commented 6 years ago

to install it, you need to install emscripten, then you just have to compile using emmake make over the repo root (I will add to the readme how to compile it), if you use the npm package it contains the compiled sources on the ccv folder

cosmo-naut commented 6 years ago

I am currently trying to use npm. The folder in my node_modules folder only contains lib and src, am I doing it incorrectly? I used the command npm install --save stroke-width-transform Then when I attempt to browserify I use browserify loadSWT.js -o bundleSWT.js however it running into problems

JeffersonH44 commented 6 years ago

ok, just let me try, I guess that the dist folder is missing on the npm package...

JeffersonH44 commented 6 years ago

Hello, currently it should work, download the latest version on npm and try to run it.

I test it on runkit and it loads well: https://npm.runkit.com/stroke-width-transform

note: Actually the build on travis is failing because I got some error on the docker image from emscripten so don't pay attention to it...

cosmo-naut commented 6 years ago

Can confirm the new build has dist after an update.

I am currently getting the following error however:

node_modules\stroke-width-transform\src\index.js:1 import loadSWT from './loadSWT'; ^ ParseError: 'import' and 'export' may appear only with 'sourceType: module'

Googling the error and looking into other GitHubs, apparently there a couple of solutions but they may be specific to other applications. This one for instance says to add "parserOptions": { "sourceType": "module", } somewhere.

This might also have something to do with it, maybe it'll help. All of this is a little out of my knowledge at the moment, I'm not sure what the relationship between all of these various softwares is

JeffersonH44 commented 6 years ago

it's weird because it should load the module using the index that is on the 'lib' folder, and in that folder there's no import and export

yorrd commented 6 years ago

@cosmo-naut @JeffersonH44 I just built the source folder with babel and referenced src/index.js manually. Works fine.