L
L
lilandre2019-02-06 22:31:15
JavaScript
lilandre, 2019-02-06 22:31:15

Why are javascript files not deployed to a new folder?

Good evening. I'm learning webpack. Javascript is caught by the server in the browser and the calculation is displayed in the console. However, the javascript folder and javascript file are not created in the system.
webpack.config.js

const path = require('path');
module.exports = {
    entry: {
        app: './src/index.js'
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, './dist'),
        publicPath: '/dist'
    },
    devServer: {
        overlay: true
    }
}

package.json
{
  "name": "webpack2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack-dev-server --open --mode development",
    "build": "webpack --mode production"
  },
  "author": "Andrii ",
  "license": "ISC",
  "devDependencies": {
    "path": "^0.12.7",
    "webpack": "^4.29.0",
    "webpack-cli": "^3.2.1",
    "webpack-dev-server": "^3.1.14"
  }
}

common.js
let add = (a,b) => a+b;
console.log(add(7,22));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Volintsev, 2019-02-07
@copist

You have two commands package.jsonin the block - - scripts are created only in memory, they are not saved to disk, and a special utility opens the page of your application in the browser at 127.0.0.1:4200 - scripts are created on disk, they are not opened in the browser. To view the application, you need to host it on an HTTP server. scripts
npm run build

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question