我一直在加载一个原生的ES模块,可以简化为src/test.tsx:
export default class Test {
constructor() {
console.log('loaded');
}
}
Run Code Online (Sandbox Code Playgroud)
我可以在我的浏览器中加载它并初始化它很好,一个la:
import('http://127.0.0.1:8085/').then(m => {
const instance = new m.default();
});
Run Code Online (Sandbox Code Playgroud)
但是..如果我想添加任何外部依赖,在这种情况下React,我似乎无法弄清楚如何定位es6并使用tsc捆绑React.所以我的dist文件包含import React from 'react';浏览器不知道如何解决,并产生:
(index):1 Uncaught (in promise) TypeError: Failed to resolve module specifier "react". Relative references must start with either "/", "./", or "../".
我的tsconfig看起来像:
{
"compilerOptions": {
"baseUrl": ".",
"rootDir": "src",
"module": "es6",
"target": "es2015",
"lib": ["es6", "dom"],
"declaration": true,
"jsx": "react",
"outDir": "dist",
"strict": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": …Run Code Online (Sandbox Code Playgroud) 我想验证USPS的给定地址(地址,城市,州,邮政编码),如果提供的地址是有效地址,则返回结果.如果不是有效地址,则返回无效地址.
那我怎么能在C#.Net中做到这一点.
audio ×1
bluetooth ×1
c# ×1
ecmascript-6 ×1
ios ×1
javascript ×1
objective-c ×1
reactjs ×1
typescript ×1
webpack ×1