Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using angular2-calendar with webpack #85

Closed
fmoessle opened this issue Nov 4, 2016 · 5 comments
Closed

Using angular2-calendar with webpack #85

fmoessle opened this issue Nov 4, 2016 · 5 comments

Comments

@fmoessle
Copy link

fmoessle commented Nov 4, 2016

Hi,

I don't get the angular2-calendar running with webpack.
I am using this starter: https://github.com/qdouble/angular-webpack2-starter

Npm throws this error, when building the app:

WARNING in ./~/angular2-calendar/~/calendar-utils/dist/src/calendarUtils.js Cannot find source file '../../src/calendarUtils.ts': Error: Can't resolve '../../src/calendarUtils.ts' in '/Users/Flo/projects/angular2-webrtc/node_modules/angular2-calendar/node_modules/calendar-utils/dist/src' @ ./~/angular2-calendar/dist/esm/src/components/week/calendarWeekView.component.js 2:0-64 @ ./~/angular2-calendar/dist/esm/src/index.js @ ./src/app/app.imports.ts @ ./src/app/app.module.ts @ ./src/main.browser.ts @ multi main

What I did:

  1. Installed angular2-calendar: npm install angular2-calendar --save

  2. Copy required css to dist via COPY_FOLDERS:
    { from: 'node_modules/angular2-calendar/dist/css/angular2-calendar.css' },
    and added this to index.html: <link rel="stylesheet" href="angular2-calendar.css">

  3. Import Module: CalendarModule.forRoot()

I don't see why it does not work? Any advise?

@fmoessle
Copy link
Author

fmoessle commented Nov 4, 2016

Turns out, that this solution works.

But maybe someone would like to read these steps.

Issue can be closed

@mattlewis92
Copy link
Owner

I think your issue was caused by webpack trying to transpile the library in node_modules which shouldn't be done as it's already transpiled: https://github.com/qdouble/angular-webpack2-starter/blob/master/webpack.config.ts#L132

@SebastianPodgajny
Copy link

I'm still having this issue

Cannot find source file '../src/calendar-utils.ts': Error: Can't resolve '../src/calendar-utils.ts'
Cannot find source file '../src/positioning.ts': Error: Can't resolve '../src/positioning.ts'

any tips?

@mattlewis92
Copy link
Owner

It sounds like your webpack config is trying to transpile your node_modules folder, make sure you have exclude: path.resolve(__dirname, 'node_modules') set on the typescript loader that is transpiling your app.

@AhmedHamedTN
Copy link

AhmedHamedTN commented Dec 26, 2017

@SebastianPodgajny I had the same errors, I figured this out, just add these packages to your package.json file . I don't think it is mentioned in the library though

"dependencies": {
"angular-draggable-droppable": "^1.1.1",
"angular-resizable-element": "^1.2.4",
"calendar-utils": "0.0.59",
"date-fns": "^1.28.5",
"positioning": "^1.3.1"
}

then,
npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants