Wednesday, 7 June 2017

Build this node project using only gulp or webpack

My project has this folder structure:

node
|   .gitignore
|   gulpfile.js
|   package.json
|   tsconfig.json
|   webpack.config.js
|   
+---build
|   |   debug.js
|   |   main.js
|   |   
|   +---client
|   |   +---scripts
|   |   |       bundle.js
|   |   |       
|   |   \---views
|   |           index.html
|   |           
|   |               
|   \---server
|       |   constants.js
|       |   server.js
|       |   
|       \---router
|           |   constants.js
|           |   router.js
|           |   
|           \---routes
|                   base.js
|                   index.js
|                   
+---gulp
|   |   constants.js
|   |   
|   \---tasks
|           default.js
|           html.js
|           typescript.js
|           
\---src
    |   main.ts
    |   
    +---client
    |   +---app
    |   |   |   app.tsx
    |   |   |   
    |   |   \---components
    |   |           hello.tsx
    |   |           
    |   \---views
    |           index.html
    |               
    \---server
        |   constants.ts
        |   server.ts
        |   
        \---router
            |   constants.ts
            |   router.ts
            |   
            \---routes
                    base.ts
                    index.ts

Gulp is used to copy HTML and compile TypeScript in build folder maintaining folder structure. But I didn't found how to also bundle front-end code and node dependencies in order to make these avaiable in build/client. After some suggestion and research I used Webpack to create bundle.js.

Now I've the expected result but I wonder if there is a way to only Gulp or Webpack, in order to simplify the build process.



via Yiyi Chen

No comments:

Post a Comment