javascript - Webpack multiple entry point confusion -


from initial understanding of webpack's multiple entry point such

entry: {     a: "./a",     b: "./b",     c: ["./c", "./d"] }, output: {     path: path.join(__dirname, "dist"),     filename: "[name].entry.js" } 

it bundle them a.entry.js, b.entry.js , c.entry.js. there no d.entry.js since it's part of c.

however @ work, these values confusing me much. why value http link , not file?

app: [   'webpack/hot/dev-server',   'webpack-dev-server/client?http://localhost:21200',   './lib/index.js' ], test: [   'webpack/hot/dev-server',   'webpack-dev-server/client?http://localhost:21200',   './test/test.js' ] 

as stated in comment on question, http urls used webpack-dev-server , hotloading module. however, want ommit modules production version of bundle, since don't need hotloading , makes bundle on 10.000 lines of code (additionally!).

for personal interest of poster, here example production config (minimalistic), project of mine (called dragjs).

// file: webpack.production.babel.js import webpack 'webpack'; import path 'path';  const root_path = path.resolve('./');  export default {     entry: [         path.resolve(root_path, "src/drag")     ],     resolve: {         extensions: ["", ".js", ".scss"]     },     output: {         path: path.resolve(root_path, "build"),         filename: "drag.min.js"     },     devtool: 'source-map',     module: {         loaders: [             {                 test: /\.js$/,                 loader: 'babel',                 include: path.resolve(root_path, 'src')             },             {                 test: /\.scss$/,                 loader: 'style!css!sass'             }         ]     },     plugins: [         new webpack.optimize.uglifyjsplugin()     ] }; 

a few things:

  • i use 1 entry point, use multiple, in example
  • the entry point refers js file - no webpack-dev-server production
  • the config file written using ecmascript2015 (thus name *.babel.js)
  • it uses sourcemaps , uglify optimization plugin
  • the presets babel-loader specified in .babelrc file
  • run webpack config via webpack -p --config ./webpack.production.babel.js

if there further questions, grateful answer them in comments.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -