Moving most of the webpack-encore-pack recipe to webpack-encore-bundle

This commit is contained in:
Ryan Weaver
2018-11-05 08:43:05 -05:00
parent eb7e0f4e5a
commit 903f0f62c6
10 changed files with 24 additions and 11 deletions
@@ -0,0 +1,3 @@
body {
background-color: lightgray;
}
@@ -0,0 +1,14 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you require will output into a single css file (app.css in this case)
require('../css/app.css');
// Need jQuery? Install it with "yarn add jquery", then uncomment to require it.
// var $ = require('jquery');
console.log('Hello Webpack Encore! Edit me in assets/js/app.js');
@@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
@@ -1,4 +1,4 @@
webpack_encore:
# The path where Encore is building the assets.
# This should match Encore.setOutputPath() in webpack.config.js.
output_path: '%kernel.public_dir%/build'
output_path: '%kernel.project_dir%/public/build'
@@ -1,5 +1,18 @@
{
"bundles": {
"Symfony\\WebpackEncoreBundle\\WebpackEncoreBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
"assets/": "assets/",
"config/": "%CONFIG_DIR%/",
"package.json": "package.json",
"webpack.config.js": "webpack.config.js"
},
"aliases": ["encore", "webpack", "webpack-encore"],
"gitignore": [
"/node_modules/",
"/%PUBLIC_DIR%/build/",
"npm-debug.log",
"yarn-error.log"
]
}
@@ -0,0 +1,14 @@
{
"devDependencies": {
"@symfony/webpack-encore": "^0.21.0",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
}
}
@@ -0,0 +1,7 @@
<bg=yellow;fg=black> </>
<bg=yellow;fg=black> The symfony/webpack-encore-pack is no longer required anymore. Instead, use symfony/webpack-encore-bundle. </>
<bg=yellow;fg=black> </>
* <fg=blue>Instead</>:
1. Remove it now: <comment>composer remove symfony/webpack-encore-pack</>
2. Use Symfony's bridge: <comment>composer require encore</>
@@ -0,0 +1,51 @@
var Encore = require('@symfony/webpack-encore');
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/')
/*
* ENTRY CONFIG
*
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if you JavaScript imports CSS.
*/
.addEntry('app', './assets/js/app.js')
//.addEntry('page1', './assets/js/page1.js')
//.addEntry('page2', './assets/js/page2.js')
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// enables Sass/SCSS support
//.enableSassLoader()
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
;
module.exports = Encore.getWebpackConfig();