Deploying webpack interaction application

I am doing a React tutorial and I made a youtube clown based on the reaction. Now I wanted to upload it to my domain (hosted by one.com), but it does not work because bundle.js cannot be found. More likely, since the application requires you to run "npm start".

I searched Google and found that I somehow needed to deploy the application by writing the deployment configuration for webpack, but I cannot get it to work.

I never understood this and I would like to ask: how can I host a javascript / nodejs / webpack website on a server? Am I on the right track?

My project is based on this starter: https://github.com/StephenGrider/ReduxSimpleStarter

UPDATE So I managed to get the bundle.js file just by typing cmd

webpack ./src/index.js bundle.js

Uploaded to server

Now the problem is that he is looking for a bundle and style at the root of the site.

I posted the site here , please check the console log

+4
source share
1 answer

Try linking the application before running any deployment script. A .json package may have a script as follows:

{
  "name": "youtube-clone",
  "scripts": {
    "package": "webpack --config webpack.config.production.js --progress --colors",
    "deploy": "npm run package && [your deployment script]"
  }
}

So, you will have a file structure like this:

.
├── src/
├── .gitignore   <= make sure your build files are ignored on source
├── package.json
├── webpack.config.development.js
└── webpack.config.production.js

If one of your configurations is created for production and one for development

+3
source

All Articles