Skip to content

Instantly share code, notes, and snippets.

@ziyuang
Created August 11, 2020 09:48
Show Gist options
  • Save ziyuang/c5fd6b8d2a94ab630b508ec6cff0e556 to your computer and use it in GitHub Desktop.
Save ziyuang/c5fd6b8d2a94ab630b508ec6cff0e556 to your computer and use it in GitHub Desktop.
cannot resolve module
export interface Dict {
[key: string]: string
}
export const g: string = "g";
import { Dict, g } from "./global";
const d: Dict = { key: "value" };
console.log(d, g);
{
"name": "app",
"version": "1.0.0",
"main": "index.ts",
"license": "MIT",
"devDependencies": {
"@types/node": "^14.0.27",
"ts-loader": "^8.0.2",
"typescript": "^3.9.7",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}
{
"include": ["**/*"],
"exclude": ["node_modules/*"],
"compilerOptions": {
"target": "esnext" ,
"module": "esnext" ,
"sourceMap": true ,
"strict": true ,
"noImplicitAny": true ,
"moduleResolution": "node" ,
"types": [
"node"
] ,
"allowSyntheticDefaultImports": true ,
"esModuleInterop": true
}
}
module.exports = {
target: "node",
entry: {
index: "./index.ts",
},
output: {
filename: "[name].js",
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment