import path = require('path');
import webpack = require('webpack');
import HtmlWebpackPlugin = require('html-webpack-plugin');
import MiniCssExtractPlugin = require('mini-css-extract-plugin');
import fs = require('fs');
github 上面看到的
1
renmu123 2021-03-10 00:11:58 +08:00 via Android
要么
import {fs} from 'fs'; 要么 fs = require('fs'); 我还真没见过 import fs = require('fs'); |
2
ayase252 2021-03-10 00:15:07 +08:00 via iPhone
没有,不在 spec 里
|
3
SilencerL 2021-03-10 00:23:19 +08:00 4
这是 TypeScript 的导入声明语法
import * as foo from “foo”; import foo from "foo"; import foo = require("foo"); const foo = require("foo"); 上述都是合法的 TypeScript 导入声明语法,具体区别有兴趣可以看下相关文档吧。 |
4
molvqingtai 2021-03-10 00:44:40 +08:00 via Android
typescript 中导入 commonjs 的写法
|
5
Hoshinokozo 2021-03-10 16:12:53 +08:00
@SilencerL 感觉下面两个等号改成 from 是不是更好理解一点:import foo from require('foo')
|