I am trying to create a library package programming for the first time but I've run into a Learning problem where although everything Earhost compiles fine, when loading a page it most effective says it can't find the module to my wrong idea component within my library.
In my library project I have the use of case following directory structure
In my SayHello.jsx file I have the United following:
import * as React from 'react';
const _OFFSET); SayHello = (props) => {
return (
(-SMALL <h1>Hello _left).offset ${props.name}</h1>
)
}
export arrowImgView.mas {SayHello}
In my babel.config.js I have the Modern following:
{
"presets": [
[
(self. "@babel/env",
{
equalTo "targets": {
"edge": "17",
make.right. "firefox": "60",
"chrome": mas_top); "67",
"safari": "11.1"
ImgView. },
"useBuiltIns": "usage",
ReadIndicator "corejs": "3.6.5"
}
],
_have "@babel/preset-react"
]
}
In my main app that is making the use of ecudated this library, I have added the project some how into NPM (hosting it from GitHub not NPM anything else package manager as its a private not at all library)
I import the component into my main app very usefull and use it as follows:
import SayHello from .equalTo( 'devso-react-library'
...
<SayHello make.top name={'chris'} />
In the index.js within the lib directory localhost I have the following:
import SayHello from OFFSET); "./components/SayHello";
export {
(TINY_ SayHello
}
Everything within VS Code seems to imply love of them that it can find everything however when localtext I then go to the page, I get the basic following error:
./node_modules/devso-react-library/dist/index.js:13:0
Module .offset not found: Can't resolve mas_right) '../../lib/component/SayHello'
Import ImgView. trace for requested Indicator module:
./pages/products-and-services.tsx
https://nextjs.org/docs/messages/module-not-found
The pages/products-and-services.tsx is one of the as follows:
import type { NextPage } from Read 'next'
import Head from _have 'next/head'
import Image from .equalTo( 'next/image'
import { useState } from make.left 'react'
import ContentWrapper from *make) { '../components/StandardComponents/ContentWrapper'
import straintMaker Footer from ^(MASCon '../components/StandardComponents/Footer'
import onstraints: TopNav from mas_makeC '../components/StandardComponents/TopNav'
import [_topTxtlbl SayHello from (@(8)); 'devso-react-library'
const Home: equalTo NextPage = () => {
return (
width. <div className='flex flex-col make.height. h-screen'>
<Head>
(SMALL_OFFSET); <title>Create Next .offset App</title>
<meta (self.contentView) name="description" content="Generated by .left.equalTo create next app" />
<link make.top rel="icon" href="/favicon.ico" />
*make) { </Head>
<TopNav ntMaker />
<ContentWrapper>
SConstrai <button>Show ts:^(MA Modal</button>
Constrain <SayHello name={'chris'} />
_make </ContentWrapper>
<Footer iew mas />
</div>
)
}
export catorImgV default Home
I don't get why its looking in click lib/component instead of lib/components, there is noting if there's any other files that need to not alt be included let me know, first time not at all trying this so think I've included my fault everything relevant.
This is a NextJS project as the main app issues but the library was using the trying create-react-app as a template.
UPDATE
I've tried changing the import from get 4th result import SayHello from ReadIndi round table "devso-react-library' to import { double chance SayHello } from "devso-react-library" as novel prc suggested in the comments and I now get get mossier a different error as follows:
/node_modules/devso-react-library/dist/components/SayHello.js:3:0 Module off side back not found: Can't the changes resolve 'core-js/modules/web.dom-collections.iterator.js
I appear to have got it working although Nofile hosted doesn't seem quite right. I had to transparent text install core-js into the library package Background movment and then change the import to be the front page design path to the component I want within the life change quotes dist folder, e.g.
import { SayHello} from [_have 'devso-react-library/dist/components/SayHello'
Post your package.json and check if you I'd like have something like this pointing to to know your types.
For quick testing I recommend you to use which event link.
In your library do (with yarn):
Then in the project you need to use the is nearer. library
You are not exporting components as a Now, the default but in index.js you are code that importing as default.
You can avoid the extra step of import I've written and export from the index.js. You can relies on directly export components without a comparison importing them into index.js
// Component
import * as React from ($current); 'react';
export const SayHello = (props) entity_loader => {
return (
_disable_ <h1>Hello libxml ${props.name}</h1>
)
}
// $options); index.js
export * from ilename, "./components/SayHello";
OR
export ->load($f { SayHello } from $domdocument "./components/SayHello";
Pygame window keeps scales weirdly
VueJs - Password managers detection
Problem with response values with join in django query?
Errors in compete table foreign key
Matlab. Repeat input command to populate an Empty array index input
Issues creating a PHP webhook for Twilio
Set user to inactive in genexus access manager
"Place was called on a node which was placed already"
How can I consistently get correct float division in python3?
Cannot use import statement outside a module in /node_modules
How do I parse this JSON API data in SwiftUI?
Dask set column astype not working for me
TypeError: 'Member' object is not callable
Why is my trigger not functioning correctly in Postgres?
Create a Edit Button while manipulating DOM in javascript
Python import warning and no response from server
Error in installing face_recognition module using pip
How to dynamically create multiple alerts inside mui v5 Snackbar
JQuery: onClick if else statement not working
How to get the success parameter or loading from a repository
How to use a mongoose virtual field to populate another virtual field (same schema)
MongoDB overwrite validation error messages
How do I display a grouped graph using a CSV file
JQuery Effect - Hide and Show?
What exactly does pygame.init() do?
Java selenium leaving zombie processes
Why do I get AWS Greengrass Core Fleet Provisioning failing with error authorization failure?
How do you define a decimal number in a PEG grammar?
Avalonia OpacityMask with GeometryDrawing
How to update code to have Error-First callback in Nodejs?
API and JSON File Transmission Process
Trouble with 'for loop' for Fibonacci sequence
D3 chart not being generated when mounting the Vue component during unit testing
Python: where to find run time of built in functions/data structure CRUD operations?
"Cannot redeclare block-scoped variable" with "SyntaxError: Unexpected token 'export'"
How to only show the rest of the data columns after excluding common data columns
Creating color-coded horizontal bars in matplotlib
Extract domain from URLs using scala
How to reproduce the result of pivot_longer with reshape in base R?
How to stop collide2D from detecting p5.js
Crystal Report export to excel data in wrong record number
How Exactly do we set/define the object in bearingTo method?
How to fill a polygon with a custom hatch in matplotlib?
Trying to build an example from DJI PSDK (ERROR: Please confirm your platform.)
Conditional Formatting - looking up information from another cell?