代码之家  ›  专栏  ›  技术社区  ›  dimart.sp

如何向弹出的create react应用程序添加预编译步骤?

  •  0
  • dimart.sp  · 技术社区  · 6 年前

    在标准弹出的create react应用程序中,当您更改源代码文件时,将看到:

    Compiling...
    Compiled successfully!
    

    我想要的是每次修改文件(理想情况下,具有一定的扩展名)时,在编译步骤之前执行一个自定义命令。 我试着用 webpack-shell-plugin :

    plugins: [
        ...
        new WebpackShellPlugin({
            onBuildStart: ['echo "Starting"'],
        })
    ]
    

    现在我明白了:

    node run start
    
    > webapp@0.1.0 prestart /path/to/a/webapp
    > node scripts/start.js
    
    Starting type checking and linting service...
    Using 1 worker with 2048MB memory limit
    Watching: /path/to/a/webapp/src
    Executing pre-build scripts
    "Starting"
    Starting the development server...
    
    ts-loader: Using typescript@3.0.1 and /path/to/a/webapp/tsconfig.json
    Compiled successfully!
    
    You can now view webapp in the browser.
    
        Local:            http://localhost:3000/
        On Your Network:  http://192.168.2.159:3000/
    
    Note that the development build is not optimized.
    To create a production build, use npm run build.
    
    Compiling...
    Compiled successfully!
    Compiling...
    Compiled successfully!
    Compiling...
    Compiled successfully!
    

    有没有别的地方我可以把我的剧本挂进去?或者另一个插件?

    0 回复  |  直到 6 年前