Skip to content

require in sidenav's compiled module is pulling in .ts files #189

Closed

Description

Using alpha.1 with webpack you might run into this kind of error:

ERROR in ./~/@angular2-material/core/annotations/one-of.ts
Module parse failed: /opt/senergy/iris-app/node_modules/@angular2-material/core/annotations/one-of.ts Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import {isPresent} from 'angular2/src/facade/lang';
| 
| 
@ ./~/@angular2-material/sidenav/sidenav.js 24:15-52

ERROR in ./~/@angular2-material/core/rtl/dir.ts
Module parse failed: /opt/senergy/iris-app/node_modules/@angular2-material/core/rtl/dir.ts Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import {EventEmitter} from 'angular2/src/facade/async';
| import {Directive, HostBinding, Output, Input} from 'angular2/core';
| import {OneOf} from '../annotations/one-of';
 @ ./~/@angular2-material/sidenav/sidenav.js 23:12-38

The cause is that the compiled sidnav.js and dir.js tries to require the ts files instead of the compiled js ones.

Workaround
Open dir.js and locate the line

var one_of_1 = require('../annotations/one-of');

(around line 12) and add the js extension to the req'd module, so it should look like this

var one_of_1 = require('../annotations/one-of.js');

Do the same in sidenav.js, i.e. make sure you have something like this around line 23-24

var dir_1 = require('../core/rtl/dir.js');
var one_of_1 = require('../core/annotations/one-of.js');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions