在main.ts中没有定义文件来运行“webpack --mode development”

时间:2018-05-14 11:40:47

标签: javascript angular typescript angular-universal

我已尝试使用此评论“webpack --mode development”来运行此代码

document.addEventListener('DOMContentLoaded', () => {
  platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => console.log(err));
});

在src / main.ts --- 我收到了这个错误...

    document.addEventListener('DOMContentLoaded', function () {
  ^
  ReferenceError: document is not defined

  - main.ts:95362 Object../node_modules/html-webpack-plugin/lib/loader.js!./src/main.ts
    /home/glad/Documents/glpdesktop-ang/src/main.ts:95362:1

  - main.ts:21 __webpack_require__
    /home/glad/Documents/glpdesktop-ang/src/main.ts:21:30

  - main.ts:70
    /home/glad/Documents/glpdesktop-ang/src/main.ts:70:18

  - main.ts:73
    /home/glad/Documents/glpdesktop-ang/src/main.ts:73:10

  - index.js:247 HtmlWebpackPlugin.evaluateCompilationResult
    [glpdesktop-ang]/[html-webpack-plugin]/index.js:247:28

  - index.js:161 Promise.resolve.then.then.then.compiledTemplate
    [glpdesktop-ang]/[html-webpack-plugin]/index.js:161:23


  - next_tick.js:188 process._tickCallback
    internal/process/next_tick.js:188:7

任何人都可以帮我解决这个问题吗?  谢谢......

0 个答案:

没有答案