Comments (7)
It looks like you're not bundling anything. After the line Asset Size Chunks Chunk Names
there are usually all modules listed that have been added to the bundle.
Is there a webpack.config.js
file in your cwd?
from webpack-dev-server.
There is a webpack.config.js in my cwd. I added the option webpack-dev-server --config webpack.conf.js
and it is running and building my files now. I can't figure out where to get the compiled assets from:
entry: {
'dashboard': '/Users/rob/projects/myProject/src/js/entries/dashboard.js',
'internal/administrator': '/Users/rob/projects/myProject/src/js/entries/internal/administrator.js',
...
},
output: {
filename: './public/compiled/js/[name].js'
Ideally I'd like to run the dev-server on port 8080 and access my assets in my script tag like this:
http://localhost:8080/compiled/js/dashboard.js
http://localhost:8080/compiled/js/internal/administrator.js
from webpack-dev-server.
That's where the --content-base
comes in. Just run webpack-dev-server --config webpack.conf.js --content-base /compiled/js
.
If you name your webpack config webpack.config.js
you don't need to specify it via the command-line. Webpack looks for a webpack.config.js
in the cwd by default.
Please note also, that you need to run webpack-dev-server
in the public
-folder if you want the webpack-dev-server to serve all files under public
.
from webpack-dev-server.
You need a config like this:
...
output: {
path: __dirname + "/public",
filename: "compiled/js/internal/[name].js"
}
and run it with webpack-dev-server --content-base public
Now you can access any file in public
and any file that would be there:
http://localhost:8080/compiled/js/dashboard.js
from webpack-dev-server.
Thank you both so much for your help. I'm able to access the files now using @sokra's config example.
I am still facing one problem though. I am using webpack to compile the assets for a large multi-page site with about 15 entry files. It appears that when one file is edited, all of the entries are rebuilt, and loading the asset blocks for about 20 seconds until all of the assets are recompiled. The documentation mentions that incremental rebuilds are possible. Is there an option I need to use to enable this? I tried both the cache and lazy options.
When we were using watchify, it would take about 20 seconds to initially build all of the files, and about 2 seconds for incremental rebuilds when a single file is edited.
Thanks again for your help.
from webpack-dev-server.
With plain webpack incremental builds are usually available via the cache
- and watch
-option. Enable both in your webpack.config.js
and run webpack --config path/to/webpack.config.js
. Rebuilds should be way faster now.
The webpack-dev-server doesn't require the watch
-option necessarily since it is designed for a development environment. But it seems like the watch-mode is only entered if options.lazy != true
(which is probably a bug @sokra?)
from webpack-dev-server.
Thanks so much for all your help. With @sokra's latest changes, everything is working as expected.
from webpack-dev-server.
Related Issues (20)
- Overlay.runtimeErrors doesn't work HOT 1
- Deep unmet peerDependency warnings from `memfs` HOT 4
- 5.0 dev server requires 'unsafe-eval' script-src in CSP HOT 3
- Types in lib/Server referring to non-existing Request_1 and Response_1 interfaces HOT 1
- Webpack dev server HRM not update vuejs file after compile error HOT 3
- After the latest webpack-dev-server upgrade, not able to start the server HOT 3
- devServer.static can't be an array. HOT 2
- devServer proxy config outputs deprecation warning in http-proxy-middleware
- Error while running example general/config-array HOT 1
- Invalid options object: options has an unknown property 'running' (webpack-cli v4.10.0) HOT 7
- Consider editing repository setings to remove "Packages" section HOT 1
- Configuring dist/main.js to be included when dev server starts HOT 3
- Types of version 5.0.0 still allow `proxy` to be an object
- The server log is being spammed HOT 2
- K
- The memory usage during project runtime after upgrade is very high HOT 2
- Additional Assets emitted via `processAssets` hook do not invalidate the build HOT 4
- Web Dev Server Inaccessible from Local Network Devices Despite Correct Configuration HOT 2
- Add visual progress indicator HOT 3
- Where to read more about app field in config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-dev-server.