• 故事、自己写
    2019-07-17
    多年之后又开始写Hello World!
    
     7
  • TechCheng
    2019-08-11
    极客时间的web版播放视频暂停会出现bug:①大概率暂停会自动播放②小概率暂停后自动重新开始播放。根本没法安静坐在电脑前看视频敲代码学习啊!!!!
     2
     3
  • 雨刃
    2019-07-23
    @all
    感谢 @Geek_144c1d 同学指出了一个 webpack.config.js 配置的错误,正确的写法应该是:
    const merge = require('webpack-merge')
    const baseConfig = require('./webpack.base.config')
    const devConfig = require('./webpack.dev.config')
    const proConfig = require('./webpack.pro.config')

    module.exports = (env, argv) => {
        let config = argv.mode === 'development' ? devConfig : proConfig;
        return merge(baseConfig, config);
    };
    展开
     1
     2
  • Geek_144c1d
    2019-07-23
    webpack.config.js 中的配置是错误的, 应该是`process.env.NODE_ENV`, 且需要将导出作为函数给webpack调用才能获取正确的传入值

    作者回复: 感谢指正,我稍后全体回复一下正确的配置

    
     2
  • Chope
    2019-07-20
    老师很赞,买一送一,很喜欢老师顺带讲了webpack的配置,之前一直不清楚,现在清晰明了,非常感谢老师
     1
     2
  • 矫健的胖虎
    2019-12-29
    使用VS Code编辑器的同学们,我推荐一个插件。在VS Code插件库中搜索“TypeScript Auto Compiler”,安装上这个插件,然后在项目工程里tsc --init之后,生成了tsconfig.json文件。之后每次保存ts文件就会自动生成对应的js文件。超级方便的~

    作者回复: 感谢推荐!

    
     1
  • h.林.p
    2019-10-29
    npm run build 报错,是webpack现版本不允许这样配置了吗
    Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
     - configuration has an unknown property 'plugin'. These properties are valid:
       object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
       For typos: please correct them.
       For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
         Loaders should be updated to allow passing options via loader options in module.rules.
         Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
         plugins: [
           new webpack.LoaderOptionsPlugin({
             // test: /\.xxx$/, // may apply this only for some modules
             options: {
               plugin: …
             }
           })
         ]
    展开

    作者回复: 是拼写错了吧,plugins,不是plugin

    
     1
  • h.林.p
    2019-10-29

    老师,npm start 之后报这个错误,编译失败
    ERROR in (webpack)-dev-server/client?http://localhost:8081
    Module not found: Error: Can't resolve './overlay' in '/Users/helinpeng/Documents/ts_in_action/node_modules/webpack-dev-server/client'
     @ (webpack)-dev-server/client?http://localhost:8081 10:14-34
     @ multi (webpack)-dev-server/client?http://localhost:8081 ./src/index.js
    展开
     2
     1
  • 康+禾
    2019-10-22
    想问一下,老师用的vscode有预装视频展示之外的插件吗,我平常工作时候用的webstorm比较多,不知道可不可以直接搬到上面用,会有影响吗

    作者回复: 视频展示之外的插件是指什么?没明白

     1
     1
  • 何以庆余年
    2019-07-19
    老师,这里的div为什么使用class而不是用id呢?id不是更好一些吗?

    作者回复: 网上有很多解释了,我说一些不同的,实际项目中id一般会留作它用,比如统计埋点、自动化测试等,所以一般习惯写class

    
     1
  • Geek_7c4953
    2020-02-05
    看完这一集的配置过程,我已经傻了...
    
    
  • 轨迹。
    2020-01-29
    老师:https://github.com/grrktime-geekbang/typescript-in-action这个地址,下载不了课件。直接访问不了

    作者回复: https://github.com/geektime-geekbang/typescript-in-action

    
    
  • 陈志浩
    2020-01-03
    webpack四个配置文件在源码中没找到额。。

    编辑回复: https://github.com/geektime-geekbang/typescript-in-action/tree/master/sourcecode/project-migration/stage-0/build

    
    
  • Hyman
    2019-12-25
    git 仓库在哪里??那四个配置文件看不懂...
    
    
  • 你若盛开 清风自来
    2019-12-14
    npm i webpack webpack-cli webpack-dev-server -D 在win上面就卡死了,不动 哎
     1
    
  • 贝壳
    2019-12-11
    老师,请问一下,Typescript只安装了全局的,执行npm start 提示找不到模块Typescript,项目本地安装以后就正常了。这里,如果项目本地没有安装,不会去找全局下的Typescript吗?

    作者回复: 不会去找全局,具体项目还需要本地安装ts

    
    
  • FEA-Dven
    2019-12-02
    dev环境运行报如下错误,主要是webpack.dev.config.js写法问题。
    Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
     - configuration has an unknown property 'devtools'. These properties are valid:
       object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?,entry?, externals?, infrastructureLogging?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
       For typos: please correct them.
       For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
         Loaders should be updated to allow passing options via loader options in module.rules.
         Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
         plugins: [
           new webpack.LoaderOptionsPlugin({
             // test: /\.xxx$/, // may apply this only for some modules
             options: {
               devtools: …
             }
           })
         ]
    将
    module.exports = {
        devtools: 'cheap-module-eval-source-map'
    }
    更改为
    const webpack = require('webpack');
    module.exports = {
        plugins: [
            new webpack.LoaderOptionsPlugin({
                options: {
                    devtools: 'cheap-module-eval-source-map'
                }
            })
        ]
    }
    dev就可以正常运行了,不知道是不是webpack版本更新的原因。
    展开

    作者回复: 拼错了,应该是 devtool,不是devtools

    
    
  • 秋簌。
    2019-11-06
    老师为什么安装完webpack webpack-cli 之后没有视频中bulid里的几个配置文件生成

    作者回复: 配置文件是需要自己写的

    
    
  • 13601994625
    2019-09-07
    我看到这里document应该会报错啊。怎么解决。

    作者回复: 建议你在 src 下只留 index.ts 和 tpl 文件夹,用到什么代码再拷贝进来。因为 ts-base 是很多节课的代码放在一起的,有些变量会重名。

    
    
  • Geek_148520
    2019-09-07
    let hello : string = "Hello word typescript"
    document.querySelectorAll('.app')[0].innerHTML = hello;
    document.querySelector('.app').innerHTML = hello;
    console.log("document.querySelectorAll('.app')[0]:",document.querySelectorAll('.app')[0])
    console.log("document.querySelector('.app'):",document.querySelector('.app')),为啥,我用querySelector选择器不能点出方法??
    展开

    作者回复: document.querySelector('.app') 这个结果可能为null,VSCode会报错,就不会有自动提示了。

     1
    
我们在线,来聊聊吧