How to use @symfony/webpack-encore - 10 common examples

To help you get started, we’ve selected a few @symfony/webpack-encore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mykiwi / symfony-bootstrapped / webpack.config.js View on Github external
* 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()

    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    // enables hashed filenames (e.g. app.abc123.css)
    .enableVersioning(Encore.isProduction())

    // uncomment if you use TypeScript
    //.enableTypeScriptLoader()

    // uncomment if you use Sass/SCSS files
    //.enableSassLoader()

    // uncomment if you're having problems with a jQuery plugin
    //.autoProvidejQuery()
;

module.exports = Encore.getWebpackConfig();
github unite-cms / unite-cms / src / Bundle / CollectionFieldBundle / webpack.config.js View on Github external
.configureBabel(() => {}, {
        useBuiltIns: 'usage',
        corejs: 3
    })

    // load vue components
    .enableVueLoader()

    // Enable sourcemaps in production mode
    .enableSourceMaps(!Encore.isProduction())

    // empty the outputPath dir before each build
    .cleanupOutputBeforeBuild()

    // versioning to avoid browser cache loading old assets
    .enableVersioning(Encore.isProduction())

    // We don't need a runtime.js for unite cms at the moment
    .disableSingleRuntimeChunk();

// export the final configuration
module.exports = Encore.getWebpackConfig();
github HecFranco / Symfony-4-by-Samples / 07_Security / 03_Complete_Login_and_Registration_System / webpack.config.js View on Github external
var Encore = require('@symfony/webpack-encore');

Encore
    // the project directory where compiled assets will be stored
    .setOutputPath('public/build/')
    // the public path used by the web server to access the previous directory
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    // uncomment to create hashed filenames (e.g. app.abc123.css)
    // .enableVersioning(Encore.isProduction())

    // uncomment to define the assets of the project
    // .addEntry('js/app', './assets/js/app.js')
    .addEntry('js/app', './assets/js/app.js')
    .addEntry('js/app_security_forms', './assets/js/app_security_forms.js')
    // .addStyleEntry('css/app', './assets/css/app.scss')
    .addStyleEntry('css/app', './assets/css/app.scss')
    // uncomment if you use Sass/SCSS files
    // .enableSassLoader()
    .enableSassLoader()

    // uncomment for legacy applications that require $/jQuery as a global variable
    .autoProvidejQuery()
;
github GraseHotspot / grase-www-portal / files / usr / share / grase / symfony4 / webpack.config.js View on Github external
// will require an extra script tag for runtime.js
    // but, you probably want this, unless you're building a single-page app
    .enableSingleRuntimeChunk()

    // allow legacy applications to use $/jQuery as a global variable
    .autoProvidejQuery()

    // enable source maps during development
    .enableSourceMaps(!Encore.isProduction())

    // empty the outputPath dir before each build
    .cleanupOutputBeforeBuild()

    // show OS notifications when builds finish/fail
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    // enables hashed filenames (e.g. app.abc123.css)
    .enableVersioning(Encore.isProduction())

    // enables @babel/preset-env polyfills
    .configureBabelPresetEnv((config) => {
        config.useBuiltIns = 'usage';
        config.corejs = 3;
    })

    // allow sass/scss files to be processed
    .enableSassLoader()

    // Enable React processing
    //.enableReactPreset()

    .copyFiles({
github chloebrqt / mercure-demo / webpack.config.js View on Github external
.splitEntryChunks()

    // 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 @babel/preset-env polyfills
    .configureBabel(() => {}, {
        useBuiltIns: 'usage',
        corejs: 3
    })

    .enableVueLoader()

    // enables Sass/SCSS support
    //.enableSassLoader()

    // uncomment if you use TypeScript
    //.enableTypeScriptLoader()
github jfoucher / Mailocal / webpack.config.js View on Github external
var Encore = require('@symfony/webpack-encore');

Encore
  .setOutputPath('public/builds/')
  .setPublicPath('/builds')
    .disableSingleRuntimeChunk()
  // this will be your app!
  .addEntry('app', './assets/js/app.js')
  .autoProvidejQuery()
  .enableSourceMaps(!Encore.isProduction())
  .cleanupOutputBeforeBuild()
  .enableBuildNotifications()
  // You need sass loader!
  .enableSassLoader()
;

module.exports = Encore.getWebpackConfig();
github Noelierx / GameHer / webpack.config.js View on Github external
{from: './node_modules/ckeditor/skins', to: 'ckeditor/skins/[path][name].[ext]'},
				{from: './assets/img', to: 'img/[path][name].[ext]'},
				{from: './assets/plugins/ckeditor', to: 'ckeditor/plugins/[path][name].[ext]'},
		])
    /*
     * 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 @babel/preset-env polyfills
    .configureBabel(() => {}, {
        useBuiltIns: 'usage',
        corejs: 3
    })

		.enablePostCssLoader()

    // enables Sass/SCSS support
    //.enableSassLoader()

    // uncomment if you use TypeScript
    //.enableTypeScriptLoader()

    // uncomment to get integrity="..." attributes on your script & link tags
github Limenius / symfony-react-sandbox / webpack.config.js View on Github external
// empty the outputPath dir before each build
    .cleanupOutputBeforeBuild()
    // will output as web/build/app.js
    .addEntry('app', ['babel-polyfill', 'whatwg-fetch', './assets/js/entryPoint.js'])
    // will output as web/build/app.css
    .addStyleEntry('css/main', './assets/sass/layout.scss')
    // allow sass/scss files to be processed
    .enableSassLoader()
    // allow legacy applications to use $/jQuery as a global variable
    .autoProvidejQuery()
    // create hashed filenames (e.g. app.abc123.css)
    .enableVersioning(Encore.isProduction())
    .enableSourceMaps(!Encore.isProduction())

// export the final configuration
module.exports = Encore.getWebpackConfig()
github Limenius / symfony-react-sandbox / webpack.config.serverside.js View on Github external
var Encore = require('@symfony/webpack-encore');

Encore
    // directory where all compiled assets will be stored
    .setOutputPath('var/webpack/')
    // what's the public path to this directory (relative to your project's document root dir)
    .setPublicPath('/')
    // empty the outputPath dir before each build
    .cleanupOutputBeforeBuild()
    // will output as app/Resources/webpack/server-bundle.js
    .addEntry('server-bundle', ['babel-polyfill', './assets/js/entryPoint.js'])
    // allow legacy applications to use $/jQuery as a global variable
    .autoProvidejQuery()

// export the final configuration
module.exports = Encore.getWebpackConfig()
github GaetanRole / sf4.4-website-skeleton-starter / webpack.config.js View on Github external
.autoProvidejQuery()
    .splitEntryChunks()

    // Copy all files from assets/ with path
    .copyFiles([
        {from: './assets/images', to: 'images/[path][name].[hash:8].[ext]'},
    ])

    // Enables @babel/preset-env polyfills
    .configureBabel(() => {}, {
        useBuiltIns: 'usage',
        corejs: 3
    })
;

module.exports = Encore.getWebpackConfig();