quentinlampin / ngx-openlayers

Angular2+ components for Openlayers 4.x
Mozilla Public License 2.0
137 stars 98 forks source link

Uncaught SyntaxError: Unexpected token import #26

Closed alienlike closed 7 years ago

alienlike commented 7 years ago

I'm getting an unexpected token import exception in Chrome due to the following code in index.js:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { components } from './components';

It seems like this started happening with the change to ngc but I'm not really sure.

FallenRiteMonk commented 7 years ago

Do you get the exact line number of the unexpected token? Also give some more information on how to reproduce this issue:

alienlike commented 7 years ago

Currently trying to get the example running but have not been successful due to #30.

alienlike commented 7 years ago

The exception occurs on line number 1 of dist/index.js, which is bundled into vendor.js with Webpack. I am not using AOT.

I'm importing as follows:

alienlike commented 7 years ago

@quentin-ol, @FallenRiteMonk Thanks for helping me out. I'm developing two apps concurrently, both using Angular 2 and OpenLayers. One is a fairly trivial map-based app, the other a significant effort that will be developed over a few years and eventually see thousands of users. I'm submitting PRs as I need new features, and will try to conform them to your vision for this project. I'm new to the entire stack (including OpenLayers), so I appreciate your help and patience. Hopefully as I learn more I can be an asset to the project.

quentin-ol commented 7 years ago

@alienlike My pleasure to help! As for the "vision" of the project, all opinions are welcome (encouraged even). Confronting ideas and proposals is always the best way forward so don't censor yourself, push PRs and let's find ways to get those features in the library! Thanks again!

alienlike commented 7 years ago

If I remove the line "module": "es2015" from tsconfig.json, the issue goes away.

Per https://www.typescriptlang.org/docs/handbook/compiler-options.html, module values "ES6" or "ES2015" may not be used in tandem with target "ES5".

quentin-ol commented 7 years ago

update: Investigating this next week.

quentin-ol commented 7 years ago

should be fixed with 0.5.0