Build this node project using only gulp or webpack

chenny

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.

basarat

I wonder if there is a way to only Gulp or Webpack

These are different tools.

  • Gulp: Task runners. Runs code segments
  • Webpack: Module bundler. Bundles code in a manner that can be used in the browser.

If you want a bundler (which you do) gulp will not suffice.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Setting up build server using Node and Gulp

Webpack with babel-loader: Using an entry point that is outside of the build project

Can I build an Angular 2 project without using webpack?

Cannot build node typescript project with only production dependencies

Module build failed: SyntaxError: Unexpected character '@' when using react-dnd in laravel (gulp+webpack+babel)

Is it possible to build a java project only once using eclipse and share?

How to automate the build of codenameone project (using only command line)?

Can't build VueJS webpack based project after removing node_modules folder

Node JS Webpack Build Failed

Build a project with gulp and requireJS mess up

Using a gulp project on another machine

Using webpack 2 from gulp (webpack-stream for webpack 2)?

`gulp build` and dependency vs. devDependency for node

How to minify webpack output using gulp?

Webpack circleci, cannot build a react project

Webpack config issue with loaders when running gulp serve or build

vscode node debugger with custom webpack build

TypeScript webpack build is not including node_modules

gulp-webpack can't resolve node modules

Detect file add/remove in node/webpack project

Source control and branches for a project using gulp

Webpack build fails only when webpack.config.js exists

Gulp + Webpack or JUST Webpack?

Cannot get GitLab CI to build my Middleman/Gulp project

Error: "build flag -mod=vendor only valid when using modules" when building Go project

How to parse whole project but build only subfolder that have dependancies on other subfolder, using cmake

How can I build an existing Windows-only Visual Studio project from Bash using WSL

Using requirejs optimizer node module with Gulp

How to require jQuery in Node using Gulp?