You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module.exports=(config,resolve)=>{constbaseRule=config.module.rule('js').test(/.js|.tsx?$/);constbabelPath=resolve('babel.js');constbabelConf=require(babelPath);constversion=require(resolve('node_modules/@babel/core/package.json')).version;return()=>{baseRule.use('babel').loader(require.resolve('babel-loader')).options(babelConf({ version }));};};
本章提要:
目录
增加以下文件
配置 babel
config/babelLoader.js
使用 babel 配置 ts
这里我们使用
babel
插件@babel/preset-typescript
将ts
转成js,并使用
ForkTsCheckerWebpackPlugin
、ForkTsCheckerNotifierWebpackPlugin
插件进行错误提示。babel.js
ts 静态类型检查
友好错误提示
config/FriendlyErrorsWebpackPlugin.js
配置 style,css、less、sass、postcss 等
postcss 配置
编译后 css 对比
src/style/index.less
dist/app.css
配置 autoprefixer
自动添加 css 前缀
postcss.config.js
转换前
转换后
开启 source map
在源文件下会有一行注释,证明开启了 sourcemap
/*# sourceMappingURL=app.css.map*/
The text was updated successfully, but these errors were encountered: