javascript-import Questions

2

I face the error: TypeError: Failed to resolve module specifier '../static/myJson.json'. The base URL is about:blank because import() is called from a CORS-cross-origin script. at runtime when th...

4

Solved

I'm learning node.js and am wondering why it uses the require syntax rather than the import syntax which React uses. i.e. const Validator = require("validator"); VS import Validator from "valid...
Noli asked 29/9, 2018 at 10:36

2

Solved

By using require(./filename) I can include and execute the code inside filename without any export defined inside filename itself. What is the equivalent in ES6 using import ? Thanks

0

I currently have a React App with Vite 2.7.1. I'm having trouble displaying static local images in Vite while in development.This works in production. I'm using: new URL(path, import.meta.url); A...
Scandura asked 14/2, 2022 at 14:24

4

Solved

Here's my lazy component: const LazyBones = React.lazy(() => import('@graveyard/Bones') .then(module => ({default: module.BonesComponent})) export default LazyBones I'm importing it like ...
Sikhism asked 11/9, 2019 at 13:24

2

Solved

I understand that we can use import {x} from "./file" and a variable x will be imported from file.js in the same directory. How is this handled if there are files of the same name with di...

2

I want to import 'jquery-validation' into an ES6 class import $ from 'jquery' import 'jquery-validation' but when I do anywhere in the same file $(...).validate({...}) I get the error Uncaug...
Kohlrabi asked 20/8, 2016 at 1:20

2

Solved

I'm migrating one of my projects to TypeScript, in that project SweetAlert2 library is used. The default way to import SweetAlert2 (both JS and CSS) is import Swal from 'sweetalert2' This works...

1

Solved

I'm trying to make a chrome extension and I wanted to use the axios package. When I try to test my code in Chrome I get this error in the console: SyntaxError: Cannot use import statement outside a...
Recalescence asked 15/12, 2020 at 22:52

1

Solved

I tried following the advice from this post and tried to use JS module imports with the following code. In summary, I'm trying to import a class from the j.js class into the f.js class, and call a ...
Sesterce asked 6/7, 2020 at 2:59

3

Solved

I am using Vue.js but with simply JS files and not vue files and I am importing a component into my main app.js like so: import autoPosts from './components/autoPosts.js'; It imports it just fin...
Jarret asked 20/9, 2018 at 14:12

8

Solved

I am learning Javascript imports and I am yet to understand when we use curly braces while importing items(functions, objects, variables) from another JS file. import Search from './models/S...
Sklar asked 6/8, 2018 at 5:29

0

I'm new to webpack and I wonder if there's a way to add dynamic chunk name and path in an import. I tried doing this, but it's wrong import(/* webpackChunkName: "${file_name}"*/ './modules/${js_pa...
Meimeibers asked 8/5, 2018 at 0:56

1

Solved

I'm working on moving some legacy code into Webpack (to help me control some dependancy hell that I'm having. All's going well so far. The issue comes from the existing codes use of Knockout. I nee...

2

Solved

in order to import jquery in an angualr4 project i do the following: npm install --save jquery npm install --save-dev @types/jquery in the app.component.ts import $ from 'jquery'; or import * ...
Tribunal asked 23/6, 2017 at 9:9
1

© 2022 - 2025 — McMap. All rights reserved.