Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 网页包配置问题,模块解析?_Typescript_Webpack_Puppeteer - Fatal编程技术网

Typescript 网页包配置问题,模块解析?

Typescript 网页包配置问题,模块解析?,typescript,webpack,puppeteer,Typescript,Webpack,Puppeteer,我试图学习现代Javascript,但遇到了一些问题。早些时候,我在这里得到了非常好的帮助,恐怕我又被卡住了 我正在尝试使用Webpack作为构建系统,用TypeScript编写一个NodeJS应用程序。我正在尝试使用Puppeter自动化web上的一些事情,但在尝试包含该模块时,Webpack阻塞了: [ger@rd] 21:53 $ npm run build > startpage@1.0.0 build /home/ger/projects/startpage > webp

我试图学习现代Javascript,但遇到了一些问题。早些时候,我在这里得到了非常好的帮助,恐怕我又被卡住了

我正在尝试使用Webpack作为构建系统,用TypeScript编写一个NodeJS应用程序。我正在尝试使用Puppeter自动化web上的一些事情,但在尝试包含该模块时,Webpack阻塞了:

[ger@rd] 21:53 $ npm run build

> startpage@1.0.0 build /home/ger/projects/startpage
> webpack

Hash: 1372c5ea796906ef9a87
Version: webpack 3.11.0
Child
    Hash: 1372c5ea796906ef9a87
    Time: 1611ms
          Asset    Size  Chunks                    Chunk Names
    run_task.js  932 kB       0  [emitted]  [big]  main
      [46] ./node_modules/puppeteer/lib 160 bytes {0} [built]
      [60] ./node_modules/puppeteer/node6/lib 160 bytes {0} [built]
      [63] ./src/run_task.ts 341 bytes {0} [built]
      [64] ./src/Badoo.ts 1.62 kB {0} [built]
        + 131 hidden modules

    WARNING in ./node_modules/puppeteer/lib/BrowserFetcher.js
    251:18-33 Critical dependency: the request of a dependency is an expression
     @ ./node_modules/puppeteer/lib/BrowserFetcher.js
     @ ./node_modules/puppeteer/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts

    WARNING in ./node_modules/puppeteer/lib/Launcher.js
    26:25-81 Critical dependency: the request of a dependency is an expression
     @ ./node_modules/puppeteer/lib/Launcher.js
     @ ./node_modules/puppeteer/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts

    WARNING in ./node_modules/puppeteer/node6/lib/Launcher.js
    26:25-81 Critical dependency: the request of a dependency is an expression
     @ ./node_modules/puppeteer/node6/lib/Launcher.js
     @ ./node_modules/puppeteer/node6/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts

    WARNING in ./node_modules/puppeteer/node6/lib/BrowserFetcher.js
    329:18-33 Critical dependency: the request of a dependency is an expression
     @ ./node_modules/puppeteer/node6/lib/BrowserFetcher.js
     @ ./node_modules/puppeteer/node6/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts

    WARNING in ./node_modules/ws/lib/BufferUtil.js
    Module not found: Error: Can't resolve 'bufferutil' in '/home/ger/projects/startpage/node_modules/ws/lib'
     @ ./node_modules/ws/lib/BufferUtil.js 35:21-42
     @ ./node_modules/ws/lib/Receiver.js
     @ ./node_modules/ws/index.js
     @ ./node_modules/puppeteer/lib/Connection.js
     @ ./node_modules/puppeteer/lib/Launcher.js
     @ ./node_modules/puppeteer/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts

    WARNING in ./node_modules/ws/lib/Validation.js
    Module not found: Error: Can't resolve 'utf-8-validate' in '/home/ger/projects/startpage/node_modules/ws/lib'
     @ ./node_modules/ws/lib/Validation.js 10:22-47
     @ ./node_modules/ws/lib/Receiver.js
     @ ./node_modules/ws/index.js
     @ ./node_modules/puppeteer/lib/Connection.js
     @ ./node_modules/puppeteer/lib/Launcher.js
     @ ./node_modules/puppeteer/lib/Puppeteer.js
     @ ./node_modules/puppeteer/index.js
     @ ./src/Badoo.ts
     @ ./src/run_task.ts
我的
webpack.config.js

const path = require('path');

module.exports = [
    {
        // devtool: 'inline-source-map',
        entry: './src/run_task.ts',
        target: 'node',
        module: {
            rules: [
                {
                    test: /\.tsx?$/,
                    use: [
                        {
                            loader: 'ts-loader',
                            options: { configFile: 'server.tsconfig.json' }
                        }
                    ],
                    exclude: /node_modules/
                }
            ]
        },
        resolve: {
            extensions: [ '.ts', '.tsx', '.js' ]
        },
        output: {
            filename: 'run_task.js',
            path: path.resolve(__dirname, 'dist')
        }
    }
];
My
package.json

{
  "name": "startpage",
  "version": "1.0.0",
  "description": "Self hosted web app to function as a web browser startpage",
  "main": "run_task.js",
  "scripts": {
    "build": "webpack",
    "start": "node dist/run_task.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Gerard Leenhouts",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^9.4.6",
    "@types/puppeteer": "^1.0.0",
    "ts-loader": "^3.5.0",
    "typescript": "^2.7.2",
    "webpack": "^3.11.0"
  },
  "dependencies": {
    "puppeteer": "^1.1.0"
  }
}
{
    "compilerOptions": {
        // "sourceMap": true,
        "outDir": "./dist/",
        "strict": true,
        "noImplicitAny": true,
        "target": "es6",
        "module": "commonjs",
        "moduleResolution": "node",
        "esModuleInterop": true,
        // "baseUrl": "./",
        // "paths": { "*": ["node_modules/*", "src/types/*"] },
        "removeComments": true
    },
    "include": [ "./src/**/*" ]
}
My
server.tsconfig.json

{
  "name": "startpage",
  "version": "1.0.0",
  "description": "Self hosted web app to function as a web browser startpage",
  "main": "run_task.js",
  "scripts": {
    "build": "webpack",
    "start": "node dist/run_task.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Gerard Leenhouts",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^9.4.6",
    "@types/puppeteer": "^1.0.0",
    "ts-loader": "^3.5.0",
    "typescript": "^2.7.2",
    "webpack": "^3.11.0"
  },
  "dependencies": {
    "puppeteer": "^1.1.0"
  }
}
{
    "compilerOptions": {
        // "sourceMap": true,
        "outDir": "./dist/",
        "strict": true,
        "noImplicitAny": true,
        "target": "es6",
        "module": "commonjs",
        "moduleResolution": "node",
        "esModuleInterop": true,
        // "baseUrl": "./",
        // "paths": { "*": ["node_modules/*", "src/types/*"] },
        "removeComments": true
    },
    "include": [ "./src/**/*" ]
}
我不知道出了什么问题,有人能告诉我吗