How to use the @symfony/webpack-encore.addEntry function in @symfony/webpack-encore

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 krzysiekpiasecki / Symfonator / webpack.config.js View on Github external
var Encore = require('@symfony/webpack-encore');
var SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');

Encore
    .addEntry('app', './src/app.js') // will create public/build/app.js and public/build/app.css
    .setOutputPath('public/assets') // the project directory where all compiled assets will be stored
    .setPublicPath('/assets') // the public path used by the web server to access the previous directory
    .enableSassLoader() // allow sass/scss files to be processed
    .enableSourceMaps(!Encore.isProduction())
    .cleanupOutputBeforeBuild() // empty the outputPath dir before each build
    .autoProvideVariables({
        $: 'jquery',
        jQuery: 'jquery',
        'window.jQuery': 'jquery',
        Popper: ['popper.js', 'default']
    }).addPlugin(
        new SWPrecacheWebpackPlugin(
        {
            cacheId: 'Symfonator',
            dontCacheBustUrlsMatching: /\.\w{8}\./,
github shopsys / project-base / webpack.config.js View on Github external
domainStylesDirectories.forEach(stylesDirectory => {
    Encore
        .addEntry('frontend-style-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/main.less')
        .addEntry('frontend-print-style-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/print/main.less')
        .addEntry('frontend-wysiwyg-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/wysiwyg.less');
});
github composer / satis / webpack.config.js View on Github external
const Encore = require('@symfony/webpack-encore')

Encore
  .addEntry('app', './views/assets/js/app.js')
  .addStyleEntry('style', './views/assets/css/style.scss')
  .cleanupOutputBeforeBuild()
  .disableSingleRuntimeChunk()
  .enableSassLoader()
  .enableSourceMaps(!Encore.isProduction())
  .setOutputPath('views/build/')
  .setPublicPath('/build')

const config = Encore.getWebpackConfig()

module.exports = config
github phpdish / phpdish / webpack.config.js View on Github external
.setManifestKeyPrefix('build/');
}

//add js entries
function findEntries(entryPath){
    const entries = {};
    const srcDirName = entryPath + '/**/*.js';
    glob.sync(srcDirName).forEach(function (filepath) {
        const name = filepath.slice(filepath.indexOf('js'), -3);
        entries[name] = filepath;
    });
    return entries;
}
const foundEntries = findEntries(config.jsPath);
for (const entryName in foundEntries) {
    Encore.addEntry(entryName, foundEntries[entryName]);
}

//add shared entry
Encore.createSharedEntry('vendor', [
    path.resolve(config.modulesPath, 'common.js'),
    path.resolve(config.modulesPath, 'dialog.js'),

    'highlight.js',
    'codemirror',
    'codemirror/mode/markdown/markdown.js',
    'art-dialog',
    'art-dialog/css/dialog.css',
    'jquery-validation',
    'jquery-pjax',
    'bootstrap-select',
    'emojione',
github shopsys / project-base / webpack.config.js View on Github external
const domainStylesDirectories = new Set(domains.domains.map(domain => {
    if (!domain.styles_directory) {
        return 'common';
    }

    return domain.styles_directory;
}));

domainStylesDirectories.forEach(stylesDirectory => {
    Encore
        .addEntry('frontend-style-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/main.less')
        .addEntry('frontend-print-style-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/print/main.less')
        .addEntry('frontend-wysiwyg-' + stylesDirectory, './assets/styles/frontend/' + stylesDirectory + '/wysiwyg.less');
});

Encore
    .addEntry('admin-style', './assets/styles/admin/main.less')
    .addEntry('admin-wysiwyg', './assets/styles/admin/wysiwyg.less')
    .addEntry('styleguide-style', './assets/styles/styleguide/main.less')
    .addPlugin(
        new StylelintPlugin({
            configFile: '.stylelintrc',
            files: 'assets/styles/**/*.less'
        })
    )
    .enableLessLoader()
    .enablePostCssLoader()
;

const config = Encore.getWebpackConfig();

config.resolve.alias = {
github SolidInvoice / SolidInvoice / webpack.config.js View on Github external
files.forEach(function(file, index) {
        if ('.js' === path.extname(file)) {
            Encore.addEntry(file.substr(0, file.length - 3), path.join(pagesDir, file));
        }
    });
} catch (err) {