This simple example demonstrates the use of webpack with a basic symfony 3 app.
- Install composer dependencies via
composer install
- Use either
yarn install
(prefered) ornpm install
to install the dependencies. - Run the build via
node_modules/.bin/webpack
or use the NPM script viayarn build
ornpm run build
- Run the dev server via
node_modules/.bin/webpack-dev-server
or use the NPM script viayarn start
ornpm start
- You can use
bin/console server:run
to run a basic webserver
- If symfony runs on another port than 8000 you need to change that port in the proxy configuration in webpack.config.js,
example:
${req.protocol}://${req.hostname}:80
. - Simply switch between the webpack-dev-server port (default: 8080) and normal web server port (i.e. 80) while running the webpack-dev-server to switch between "dev mode" and "normal mode".