please, I started learn npm. If I want instal "@fullcalendar" and used it i get error: " Uncaught TypeError: Failed to resolve module specifier "tslib". Relative references must start with either "/", "./", or "../". "
I have this structure: www/templates/node_modules/ www/templates/assets/calendar.js
It is start of my calendar.js file:
import {Calendar} from '../node_modules/@fullcalendar/core/main.js';
import dayGridPlugin from '../node_modules/@fullcalendar/daygrid/main.js';
import timeGridPlugin from '../node_modules/@fullcalendar/timegrid/main.js';
import listPlugin from '../node_modules/@fullcalendar/list/main.js';
other code
In the moment where is imported {Calendar} its throw error. In @fullcalendar/core/main.js i see:
import './vdom';
import { __extends, __assign } from 'tslib';
import { render, createElement, CalendarRoot, CustomContentRenderContext, CalendarContent, flushToDom, DelayedRunner, CalendarDataManager, isArraysEqual, applyStyleProp, CalendarApi } from '@fullcalendar/common';
export * from '@fullcalendar/common';
But i think that way to tslib (and other import libs) is incorrect. But tslib is in directory www/templates/node_modules/tslib. I dont want edit installed package (i think that is not correct way). Can I set path in npm config? It is possible? Or what is the best way?
Thanks, A.
Your imports are wrong. You don't need the full path to your node modules. You can import them like:
import Calendar from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import listPlugin from '@fullcalendar/list';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.