javascript - Uncaught TypeError: Failed to resolve module specifier "tslib". Relative references must start wi

please, I started learn npm. If I want instal "@fullcalendar" and used it i get error: "

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/mon';
export * from '@fullcalendar/mon';

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.

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/mon';
export * from '@fullcalendar/mon';

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.

Share Improve this question asked Jul 24, 2020 at 7:49 AdiOverRideAdiOverRide 1621 gold badge2 silver badges10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 1

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';

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744816698a4595368.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信