Updated recipes of webpack-encore.

This commit is contained in:
Jan Böhmer 2020-01-07 19:16:39 +01:00
parent 5d86ba776a
commit 4e4b10ffbd
6 changed files with 48 additions and 6 deletions

View file

@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

View file

@ -0,0 +1,2 @@
#webpack_encore:
# strict_mode: false

View file

@ -1,4 +1,25 @@
webpack_encore:
# The path where Encore is building the assets.
# This should match Encore.setOutputPath() in webpack.config.js.
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# if using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# preload all rendered script and link tags automatically via the http2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# if you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
# frontend: '%kernel.project_dir%/public/frontend/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true

View file

@ -5,7 +5,9 @@
"bootstrap": "^4.4.1",
"jquery": "^3.3.1",
"popper.js": "^1.14.7",
"webpack-notifier": "1.8.0"
"core-js": "^3.0.0",
"regenerator-runtime": "^0.13.2",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,

View file

@ -773,17 +773,19 @@
]
},
"symfony/webpack-encore-bundle": {
"version": "1.0",
"version": "1.6",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "5880e1fef9f9eb6a523e698a63f8feabcc8b0834"
"version": "1.6",
"ref": "69e1d805ad95964088bd510c05995e87dc391564"
},
"files": [
"./assets/css/app.css",
"./assets/js/app.js",
"./config/packages/assets.yaml",
"./config/packages/prod/webpack_encore.yaml",
"./config/packages/test/webpack_encore.yaml",
"./config/packages/webpack_encore.yaml",
"./package.json",
"./webpack.config.js"

View file

@ -22,6 +22,12 @@
var Encore = require('@symfony/webpack-encore');
const CopyPlugin = require('copy-webpack-plugin');
// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
@ -66,6 +72,11 @@ Encore
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
// enables Sass/SCSS support
//.enableSassLoader()