es-module

Is it possible to use react-select in the browser from the cdn?

拥有回忆 提交于 2020-07-23 06:45:54
问题 Is it possible to use react-select directly from the browser without bundlers nowadays? The most recent version that I found to be able to do so was 2.1.2: How to import from React-Select CDN with React and Babel? They used to provide react-select.min.js in the umd format back then. Nowadays they have react-select.browser.esm.js and react-select.browser.cjs.js (https://unpkg.com/browse/react-select@3.1.0/dist/), but I couldn't get any of those working from the browser. 来源: https:/

“SyntaxError: Cannot use import statement outside a module” when writing test with typescript with lit-html

孤者浪人 提交于 2020-06-16 04:16:29
问题 I use typescript to write a simple demo with lit-html: import {html, TemplateResult} from 'lit-html'; export default function sayHello(name: string): TemplateResult { return html`<h1>Hello ${name}</h1>`; } and use jest to write some simple test: import sayHello from "./sayHello"; import {render} from "lit-html"; beforeEach(() => { render('', document.body); }) describe('sayHello', () => { it('says hello', () => { render(sayHello('world'), document.body); const component = document

Import js from script tag in HTML file. Possible?

爷,独闯天下 提交于 2020-06-08 17:14:23
问题 I want to access data from script tag in html file, produced by cms. Is it possible to do this without polluting global namespace? I've tried to use es6 modules but I've failed and I couldn't find any info about it. <script> let list = ['a','b','c']; export default list </script> //test.js import list from './index.html' Error: 'http://localhost:8080/index.html net::ERR_ABORTED 404' or: 'Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict

Import js from script tag in HTML file. Possible?

北慕城南 提交于 2020-06-08 17:13:05
问题 I want to access data from script tag in html file, produced by cms. Is it possible to do this without polluting global namespace? I've tried to use es6 modules but I've failed and I couldn't find any info about it. <script> let list = ['a','b','c']; export default list </script> //test.js import list from './index.html' Error: 'http://localhost:8080/index.html net::ERR_ABORTED 404' or: 'Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict