Bpmn-js ver 1.0.2 browserify problem


#1

hi! After upgrading my npm bpmn-js module from version 0.31 to 1.0.2 my grunt browserify task quarrels like this:

Running "browserify:app" (browserify) task

/home/fedd/Documents/Work/NetBeansProjects/rex/node_modules/bpmn-js/lib/Viewer.js:7
import {
^
ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’
Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings.

and another time like this,

Running "browserify:app" (browserify) task

SyntaxError: ‘import’ and ‘export’ may only appear at the top level (2:0) while parsing /home/fedd/Documents/Work/NetBeansProjects/rex/node_modules/bpmn-js/lib/Modeler.js while parsing file: /home/fedd/Documents/Work/NetBeansProjects/rex/node_modules/bpmn-js/lib/Modeler.js
Warning: Error running grunt-browserify.a Use --force to continue.
Aborted due to warnings.

Sorry if this is a known thing, I am downgrading for now, but probably it is really a problem


#2

Have a look at the changelog to figure out the problem.


#3

You must now configure a module transpiler such as Babel or Webpack to handle ES module imports and exports

if I only knew how to do this. I have just managed to create a gruntfile without any knowledge/exerience =(

I have based it on the example here, and it wasn’t updated. Can I ask for a hint - will I manage to configure a module transpiler with browserify and how?


#4

Bear with us until we’ve updated the examples to bpmn-js@1 :wink:


#5

the future hath cometh, and I am confused with babelify env and es2015-commonjs plugins/presets :frowning:

will wait for a working example.

(I’ve read around a bit and I think I’d wish to utilize “babel” in case I need something from it later, better without an extra file like .babelrc. too many build configs already)


#6

Checkout the updated bundling example for hints how to bundle bpmn-js along with your application.

If you’d like to be a little bit more independent from the future: We offer a pre-packaged variant of our toolkit, too that can be integrated with a single script include.


#7

Thanks, will look into it!


#9

hi,

when reading


, had to change

import BpmnViewer from 'bpmn-js';

to

import BpmnViewer from 'bpmn-js/lib/Viewer';

or

import Viewer from 'bpmn-js';

Don’t know if it works either way, but the first variant didn’t work for me.

And now I’m up to date!


#10

Hi,

can you provide the exact steps you did? I cannot reproduce this issue.


#11

Hi Philipp,

sorry I wasn’t clear, everything is working now! Thank you!

Regards,
Fedd