Ionic2 Browserify and external TS library


#1

Hello there,

So I’ve started working on an app using ionic2 alpha, and gladly upgraded to latest cli and frramework (or whatever it was called now the name changed).

I’ve updated again today after our Jenkins build was no longer outputting any www/build, (Jenkins always installs latest CLI for now as long as we haven’t reached stable).

We also have a library which I use in all our Angular2 Projects which contains domain models, and services which directly communicate with our API. This way we don’t have to maintain it on 3/4 locations :-).

Anyhow, recently ionic2 moved away from webpack, a pity since I just started understanding how it worked, now I believe it’s using browseriify, I have the feels that it’s quite abstract int’s workings and configuration, I can’t seem to figure out how to configure it.

It keeps complaining about my library’s TS files with the following error:

import {Injectable} from "angular2/core";
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

I’m not entirely sure where to look at with this error, anyone have more knowledge about this?


#2

I have the feeling I need to figure out the way to find an equal value as includes in the webpack loader, and add node_modules/my-lib to it. Can’t figure out what it might be, looking at browserify and ionic browserify source now.


#3

Check if the following suggestion will help you to fix the problem:


#4

Silly Question, is there an example anywhere of an up to date webpack based gulpfile? I see loads of changes right now.

But I’ll try to see if I can get ionic-gulp-webpack working.


#5

Example: https://www.npmjs.com/package/ionic-gulp-webpack helps a little.


#6

Sorry, I don’t know any, a quick Google search returned this one which might help you get started.


#7

hurr durr.

I posted that 41 minutes ago ;-). Thnx for the effort though.


#8

The link that I posted is actually different than that one that you posted so I thought it still might be helpful. :slight_smile:


#9

Whoopsie, thought it was the same, Anyways I’ve gotten it to work now. So I’m happy again.

With Webpack that is.