Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
app
bin
config
lib
log
public
tmp
vendor
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
config.ru
package-lock.json
package.json
webpack.config.js

README.md

Simpacker webpack-dev-server example

Install packages

$ npm install --save-dev webpack-dev-server

Edit webpack config

   output: {
     path: path.resolve(__dirname, "public/packs"),
-    publicPath: "/packs/",
+    publicPath: isProd ? "/packs/" : "//localhost:8081/packs/",
     filename: isProd ? "[name]-[hash].js" : "[name].js"
   },
   resolve: {
     extensions: [".js"]
   },
-  plugins: [new WebpackAssetsManifest({ publicPath: true })]
+  devServer: {
+    contentBase: path.resolve(__dirname, "public"),
+    publicPath: "/packs/",
+    host: "localhost",
+    port: 8081,
+    headers: {
+      "Access-Control-Allow-Origin": "*"
+    }
+  },
+  plugins: [new WebpackAssetsManifest({ publicPath: true, writeToDisk: true })]
 };

Run

$ ./node_modules/.bin/webpack-dev-server
You can’t perform that action at this time.