Questions tagged [import]

The overall procedure of transferring information from an external origin into an individual's framework, software, or dataset.

What is the best way to save a pandas pivot table for easy re-importing?

I need to securely share a pandas pivot table with a third party without exposing my python code. The pivot table is connected to additional columns, and when I export it to a CSV file then import it back into Python, some formatting is lost. How can I ...

Having difficulty bringing in a Python function into Jupyter notebook

My Jupyter notebook is equipped with Python 3.5, which I utilize for data analysis from a simulation coded in Python. Upon running the simulation in the initial cell using: %run control.py I encountered the following error: > ImportError ...

Guide to setting up an interface-only project (along with its dependent projects) on NPM

I'm encountering two problems with my TypeScript project. Imagine I have a interface-only TypeScript project called myproject-api. My plan is to implement the interfaces in two separate projects named myproject-impl1 and myroject-impl2. I am utilizing Ler ...

Importing multiple features in Angular

[UPDATE]: Oops, my mind is a bit muddled from fatigue and I've mixed up two ideas which resulted in a rather meaningless question... Let's just blame it on the coffee! :P This may not be a pressing issue but more of a quest for knowledge... I'm c ...

Mastering the Art of Harnessing External Templates in Meteor Mantra

I have been diving into the Mantra style guide () in order to integrate it with meteor. What confuses me is determining the "right" approach for using external templates with meteor and mantra. Specifically, I'm unsure about handling CSS and JS files. I am ...

Tips for importing a file with a dynamic path in Angular 6

I'm facing an issue where I need to import a file from a path specified in a variable's value. For example, it looks like this: let test = require(configurationUrl); Here, configurationUrl represents a path such as '../../assets/app.conf.json'. However, ...

Python error: default variable is not initialized when importing the module

Imagine I have a module called foo.py that includes the following function: def bar(var=somedict): print(var) In my main program, main.py, I import this module, declare the variable somedict and then execute the function bar: from foo import * somed ...

Can one bring in a JavaScript function using webpack?

I have a unique JS library called: say-my-greeting.js function SayMyGreeting (greeting) { alert(greeting); } Now I want to incorporate this function in another (.ts) file; special-class.ts import SayMyGreeting from './say-my-greeting.js' ex ...

How can I transfer the database from my live server to my localhost using php?

I have a large SQL database operating on a live server. Whenever a bug arises, my usual process is to manually export the database from phpmyadmin (by viewing the output text), dropping the localhost database, importing the output dump, and then importing ...

The comparison between importing TypeScript and ES2015 modules

I am currently facing an issue with TypeScript not recognizing the "default export" of react. Previously, in my JavaScript files, I used: import React from 'react'; import ReactDOM from 'react-dom'; However, in TypeScript, I found that I had to use (afte ...

Differences between Local and Global importing in Python

Is there a way to force my interpreter (2.7) to import a module from site packages in case of a conflict? Let's say you are working with a directory structure like this: top_level ----cool_mod ----init.py ----sweet_module.py You already have swee ...

What is the solution for resolving the error message "Property '' does not exist on type 'typeof import'"?

Hi everyone, I'm a new Angular developer who is working on implementing authentication. I recently added the auth0-angular package to my project and now I'm encountering an error when creating a WebAuth() instance in my code editor (VS Code). The error me ...

Access NodeJS libraries from different directories instead of the default "node_modules" folder without relying on relative paths

In my NodeJS project, I have two folders for libraries - one named "node_modules" which contains publicly available packages, and another called "somename_modules" where we keep proprietary libraries. It's common knowledge that when we use "import" or "re ...

The build process encountered an error due to the absence of ESLint configuration after the import

Having recently worked on a Vue project created using Vue CLI, I found that eslint was also included in the project. Although I haven't utilized eslint much up to this point, I understand that it is beneficial for catching stylistic errors, semantic e ...

A guide to importing and utilizing images within next.js

I attempted to import an image using the code below, but encountered an error: import Image1 from '../public/IconGBANTQualifiedLeads.png' The error message reads: ./public/IconGBANTQualifiedLeads.png Module parse failed: Unexpected character '�' (1: ...

Utilize ES6 syntax to bring in a package as an extension of another package

To expand map projections in D3, it is recommended to import the necessary packages like so: const d3 = require("d3") require("d3-geo-projection")(d3) This allows you to access methods such as d3-geo-projection's geoAiry method from th ...

Why are imported modules unable to reach global variables in Node?

As I delve deeper into using ES6 and organizing my code across multiple files for better readability and version control, I've encountered an issue that has me puzzled. In one of my scenarios, I have a class defined in a separate file called class.js, ...

The appearance of an unforeseen * symbol caused a

Having issues with this particular line of code, import * as posenet from '@tensorflow-models/posenet' The error 'Uncaught SyntaxError: Unexpected token *' keeps popping up, I have the latest version of Chrome installed and I've ...

Encountering issues with importing Vue library

I have recently set up a Vue application using the Vue CLI. Everything seems to be working smoothly except for an import issue that I encountered. The following import statement works without any errors: import Vuex from 'vuex'; However, this ...

The issue with Angular 4 imports not refreshing in a .less file persists

Currently, I am in the process of developing a small Angular project that utilizes less for styling purposes. My intention is to separate the styling into distinct folders apart from the components and instead have a main import file - main.less. This fil ...

Guide on dynamically adding images in React.js based on their filenames

Currently, I am in the process of implementing a language selection feature and I need to incorporate flags. Initially, I attempted to use Unicode emojis for flags, but unfortunately, they did not display properly when retrieved from React variables. As a ...

What is the best way to add a media query to a <style> element?

I have implemented Skrollr for my Parallax animations, allowing me to use Parallax keyframes without writing them inline. To make the plugin utilize external stylesheets for the keyframes, it uses AJAX to locate the stylesheets imported via <link>. ...

Transferring .jsx files between React applications

Recently, I attempted to create separate .jsx files in React. I successfully made a couple of them using export default name / import name from ./name.jsx'. However, I encountered an issue. Initially, when I imported Route and Links from react-router, ...

What is the best way to bring in styles to a Next.js page?

I am facing an issue with my app where I have a folder called styles containing a file called Home.module.css. Every time I try to include the code in my pages/index.js, I encounter the same error message saying "404 page not found.." import styles from ' ...

Issue with importing styles within a media query

I am having trouble importing a style that is based on a media query. When I try to import the styles, it doesn't seem to work. However, if I directly include the styles within the media query itself, they show up on the page. For reference, you can ...

Is it possible to integrate the `lnurl` npm library with Nextjs14?

When starting the first boilerplate project in Nextjs14, remember to include the following command: npm i lnurl However, after installation and attempting to use the API by importing 'lnurl', an error occurs as shown below: Import trace for requested modu ...

Adding a JSON array to a ListView

I am new to Java programming language, so please forgive any obvious or silly mistakes I may have made. I am working on an activity in which I retrieve a JSON encoded string from a PHP file and display it in a simple list view. However, I am encountering ...

The issue of using an import statement outside a module arises when executing Protractor

I am facing an issue while running Protractor with my two files. When I execute the command "protractor protractor.config.js", I encounter the following error: D:\work\staru-app>protractor protractor.config.js [16:57:17] I/launcher - Running ...

I encountered an import error while attempting to set up Kivy on my system

Encountering the issue of receiving the error message "Unable to import 'kivy' Pylint(E0401:import-error)" while attempting to import it into a file using the command "import kivy". Following the installation of kivy through the execution of the ...

Error: Loki cannot be used as a constructor

Can anyone assist me in understanding why this code is not functioning correctly? Here's what my index.ts file in Hapi.js looks like: import { Server, Request, ResponseToolkit } from '@hapi/hapi'; import * as Loki from 'lokijs'; ...

Retrieve content from Wordpress blog including image preview

Can someone help me find a PHP script that can import posts from my WordPress blog and display them on another website, complete with a thumbnail of each blog post? Thank you in advance for your assistance! ...

Using TypeScript with Vue and Pinia to access the store

Is it necessary to type the Store when importing it to TypeScript in a Pinia Vue project? // Component <p>{{ storeForm.firstName }}</p> // receiving an error "Property 'storeForm' does not exist on type" // Store ...

JavaScript node_modules import issue

I've been grappling with this issue for quite some time now. The problem lies in the malfunctioning of imports, and I cannot seem to pinpoint the exact reason behind it. Let me provide you with a few instances: In my index.html file, which is completely e ...

The import component path in Angular 4/TypeScript is not being recognized, even though it appears to be valid and functional

I'm currently working on building a router component using Angular and TypeScript. Check out my project structure below: https://i.stack.imgur.com/h2Y9k.png Let's delve into the landingPageComponent. From the image, you can see that the path to the com ...

Automate the process of triggering the "Organize Imports" command on a VSCode / Typescript project through code

Is there a way to automatically run VSCode's 'Organize Imports' quickfix on every file in a project, similar to how tslint can be run programatically over the entire project? tslint --project tsconfig.json --config tslint.json --fix I want to avoid manua ...

Prevent redundant Webpack chunk creation

I am currently working on integrating a new feature into my Webpack project, and I have encountered a specific issue. Within the project, there are two entry points identified as about and feedback. The about entry point imports feedback, causing both abo ...

Is it feasible to incorporate a third-party JavaScript file into a React application?

I have a JavaScript file from a previous MVC project that generates a basic table using ExtJS. Currently, I'm working on developing a new React application with a navigation bar and sidebar. My goal is to explore the possibility of importing the exis ...

Incorporating external JavaScript files into a React Element

I am currently revamping my Portfolio Site to incorporate modals into one of the pages as part of the transition to a Single Page Application (SPA). The JavaScript code for these modals is stored in a "main.js" file, and the necessary tags are included in ...

Incorporating a custom transpiled file format into Typescript imports

I am trying to import a file format .xyz that does not have fixed types for all instances of the format: import { Comment, Article, User } from "./Blog.xyz" However, I keep getting this error message: TS2307: Cannot find module './Blog.xyz' or ...

What steps do I need to take to include React in my background.js script for a chrome

I'm currently facing an issue with my React code that I need to include in my background.js file. However, I encountered the following error message: SyntaxError: Cannot use import statement outside a module The specific import causing this error is: imp ...

What is preventing me from utilizing require in vue-router's routes.js file?

Vue-router typically requires the standard setup as outlined below: In main.js, the routes.js file is required and it usually contains code similar to this: //routes.js import Register from './components/Register' import Login from './comp ...

What kind of impact on performance can be expected when using index.ts in a Typescript - Ionic App?

When setting up the structure of a standard Ionic app, it typically looks like this: app pages ----page1 ---------page1.ts ----page2 ---------page2.ts If I were to include an index.ts file in the pages folder as follows: pages/index.ts export { Page1 } ...

Encountering difficulty importing TypeScript files dynamically within a Deno executable

When attempting to import a file from aws in an exe using its public link based on user input, I am facing difficulties For example, I generated my exe with the command below deno compile --allow-all main.ts Users execute this exe using commands like ./e ...

What is the process for importing a list of classes from a module?

How can I import only a specific, predefined list of classes from a Python module? Let's say I have modules a.py and b.py in the same directory with the following code: #a.py class Foo(object): '''definition of class Foo goes here''' class Bar(object ...

Using TypeScript to import a Vue 2 component into a Vue 3 application

Recently, I embarked on a new project with Vue CLI and Vite, utilizing Vue version 3.3.4 alongside TypeScript. In the process, I attempted to incorporate the vue-concise-slider into one of my components. You can find it here: https://github.com/warpcgd/vu ...

Utilizing jQuery-dependent plugins in a Create-React-App: A comprehensive guide

Looking to integrate bootstrap and other jQuery plugins like datepicker and carousel into my React app that is built with create-react-app. This is the method I am using to import jQuery and bootstrap: import React, { Component } from 'react'; import 'bo ...

Unfortunately, the utilization of an import statement outside a module is restricted when working with Electron

Is there a solution to the well-known problem of encountering the error message "Cannot use import statement outside a module" when working with an Electron-React-Typescript application? //const { app, BrowserWindow } = require('electron'); import { app, B ...

ES6 import of CSS file results in string output instead of object

Too long; Didn't read I'm facing an issue where the css file I import into a typescript module resolves to a string instead of an object. Can someone help me understand why this is happening? For Instance // preview.ts import test from './ ...

Is there a way to selectively import specific functions from a file in NextJs/React rather than importing the entire file?

Imagine this scenario: we have two files, let's call them File A - export const a = () => {} export const b = () => {} Now, consider importing this into File B - import { a } from 'path' When I tried running npm run analyze, it showed that I am imp ...

Is it possible to automatically correct all import statements in a TypeScript project?

After transferring some class member variables to a separate class in another file, I realized that these variables were extensively used in the project. As a result, approximately 1000 .ts files will need their imports modified to point to the new class/f ...

Combine es6 imports from the identical module using an Eslint rule or plugin

Looking to consolidate my ES6 imports from a single module into one for my React project. For example: import { Title } from "@mantine/core"; import { Center } from "@mantine/core"; import { Divider } from "@mantine/core"; T ...

Cannot locate module using absolute paths in React Native with Typescript

I recently initiated a new project and am currently in the process of setting up an absolute path by referencing this informative article: https://medium.com/geekculture/making-life-easier-with-... Despite closely following the steps outlined, I'm en ...

Understanding the basics of Maven imports: troubleshooting class not found errors

After adding the following to my pom.xml: <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20170516</version> </dependency> The desired json classes, such as JSONArray, ...

Creating routes with dynamic components or importing dynamic components in Angular 2 is a versatile and powerful feature

Is there a way to dynamically create routes or import components based on data? For instance, suppose I have a JSON file with objects containing RouteNames, paths, and ComponentNames. How can I dynamically generate route definitions from this data? The ch ...

What is preventing me from importing selenium?

Why am I unable to import selenium? Here is how my code appears in Visual Studio Code: https://i.stack.imgur.com/Goqde.png This issue only started after I upgraded to Windows 11, which resulted in the deletion of the C-drive. Does anyone have a solution ...

What is the process of importing node modules and referencing the exported name of a module?

Upon importing { createStore } from 'redux' in index.js, what exactly does 'redux' refer to? I attempted to search through the src directory of the redux package within the node_modules folder but was unable to locate any export named 'redux'. Could it b ...

Having trouble importing DropDown and MenuButton components from materialUI Joy

As I attempt to create a simple menu dropdown using Dropdown and MenuButton from the MaterialUI Joy library, I encountered an issue. After installing the library, I could not locate the DropDown and MenuButton folders within the 'joy' directory in the '@mu ...

"Changing the name of a symbol that is automatically imported from an internal library in

Within my module, I find myself using the Element class that is implicitly imported from the "dom" internal library. However, I also need to create my custom Element class within the same module. This presents a problem due to the name collision and poten ...

What is the best way to bring in the original files of a JavaScript library?

Currently I am utilizing a library called selection.js. Within my application, I am importing from node_modules with the following code: import * as Selection from '@simonwep/selection-js' However, what I am interested in doing is modifying the source fi ...

Switching the Require statement to an Import statement led to an error popping up

Currently, I am exploring the use of Ajv with typescript. import { Ajv } from "ajv"; let ajv = new Ajv({allErrors: true}); I have encountered an error and I'm unsure why it is occurring: [ts] 'Ajv' only refers to a type, but is being used as a value ...

The dynamic import() syntax is not compatible with the target environment, preventing the use of external type 'module' in a script

I am currently facing an issue with my React app. The command npm start is working as expected, but when I try to run npm run build, it keeps failing. It's crucial for me to run npm run build in order to deploy the app on a website. I have already sp ...

What are the steps for importing KnockOut 4 in TypeScript?

It appears straightforward since the same code functions well in a simple JS file and provides autocompletion for the ko variable's members. Here is the TypeScript code snippet: // both of the following import lines result in: `ko` undefined // impo ...

Encountered a problem while trying to import TensorFlow as 'tf' in Google

For months, I had been using a simple command "import tensorflow as tf" to import tensorflow on my Colab notebook. However, recently, the same code and notebooks started showing an error "from future imports must occur at the beginning of the file". Upon ...

Converting <reference path/> directive to ESM import: A step-by-step guide

As I embark on developing a TypeScript application, I've reached the realization that I am not a fan of using the <reference path /> triple-slash directive. Instead, I prefer utilizing import 'something'. However, every time I attempt to substitute ...

Exploring the difference between using import global and getStaticProps in a Next.js/React

As a newcomer to Next.js, I have a question regarding importing JSON files in my index.js file located in the pages directory. I have a component that will display a list from a JSON object, and I'm curious about the difference between importing this JSON ...

What is the best way to access a Python file from both within the same folder and from outside of it

I am facing an issue with the file hierarchy in my project. Here is how the files are structured: folder | classes | class1.py class2.py test_class2.py main.py Apologies, I am unable to format text properly. The main.py and classes fold ...

You can only import Next.js Global CSS from your Custom <App> and not from any other files

Initially, my React App functioned perfectly with global CSS included. However, after running npm i next-images, adding an image, modifying the next.config.js file, and executing npm run dev, I encountered the following notification: "Global CSS cannot ...

Is there a way to bring in both a variable and a type from a single file in Typescript?

I have some interfaces and an enum being exported in my implementation file. // types/user.ts export enum LoginStatus { Initial = 0, Authorized = 1, NotAuthorized = 2, } export interface UserState { name: string; loginStatus: LoginStatus; }; ex ...

Guide to programmatically importing a JSON file into MATLAB?

I need help loading data from a JSON file into MATLAB with comma delimiters. The data format looks like this: {"created_at": "Mon Oct 27 20:35:47 +0000 2014", "tweet": "Silver Finished Up, Gold, Copper, Crude Oil, Nat Gas Down - Live Trading News http://t ...

ReactJS Import Package Performance Evaluation

I've been diving into the concept of "import" in React and have already gone through the documentation. Can someone shed light on why there is a cost difference between using "{" or not? In my specific scenario, would it be more beneficial to use it or n ...

Minimize the number of HTTP requests by including CSS and JS files in PHP

I've been considering a method to reduce the number of HTTP requests made when loading a page by minimizing the amount of downloaded files, while still keeping separate files on the server. The thought process is as follows: <!DOCTYPE html> <htm ...

Working with relative paths in React Native TypeScript using WebStorm

My variable color is located in the path app/theme. To set it up, I created a package.json file in app/package.json with the following content: { "name": "app" } Now, to import color in TypeScript files, I use the following syntax: import { color } fro ...

Using importXML with Internet Explorer 11

My project website includes a roster page that retrieves XML data. Previously, this functionality worked across all browsers but now it only works in Chrome. In IE11, it seems that the importXML function is not functioning correctly as the roster data is m ...

Is there a way to transfer information from an ajax function to an express js server?

Is there a way to transfer data from a separate JS file to my Express.js server? I'm attempting to parse XML files using AJAX/jQuery and send the resulting data to an Express.js server. The parser is located in a different file within the /public/jav ...

Kindly make sure that the package.json file contains a valid "main" entry

Just added Bootstrap to my React project using npm. Imported Bootstrap with the following code: import 'bootstrap/dist/css/bootstrap.min.css'; However, I encountered an error that says: Cannot find module 'D:\project\my-app\n ...