Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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()
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()
.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();
// https://webpack.js.org/plugins/define-plugin/
.configureDefinePlugin((options) => {
options.DEBUG = !Encore.isProduction();
})
// create hashed filenames (e.g. app.abc123.css)
.configureFilenames({
js: '[name].[hash:8].js',
})
.enableVersioning()
;
var config = Encore.getWebpackConfig();
config.externals = {
jquery: 'jQuery',
BX: 'BX'
};
// export the final configuration
module.exports = config;
.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')
// .addStyleEntry('css/app', './assets/css/app.scss')
// uncomment if you use Sass/SCSS files
// .enableSassLoader()
// uncomment for legacy applications that require $/jQuery as a global variable
// .autoProvidejQuery()
;
module.exports = Encore.getWebpackConfig();
// 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()
;
module.exports = Encore.getWebpackConfig();
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes()
// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
// uncomment if you use API Platform Admin (composer req api-admin)
//.enableReactPreset()
//.addEntry('admin', './assets/js/admin.js')
;
module.exports = Encore.getWebpackConfig();
test: /jquery-(migrate|ui)(|.min).js$/,
use: [
{
loader: 'imports-loader?define=>false'
}
]
})
;
/*
console.log(Encore.getWebpackConfig());
console.log(Encore.getWebpackConfig().plugins);
console.log(Encore.getWebpackConfig().module.rules);
console.log(JSON.stringify(Encore.getWebpackConfig().module.rules, false, 2));
*/
const config = Encore.getWebpackConfig();
config.context = __dirname;
config.resolve.alias = {
'jquery': path.resolve(__dirname, npmDir+'/jquery/dist/jquery.js'),
//'jquery-ui': path.resolve(__dirname, npmDir+'/jquery-ui/jquery-ui.js'),
'jquery-ui': path.resolve(__dirname, npmDir+'/jquery-ui-bundle/jquery-ui.js'),
//'datatables.net': path.resolve(__dirname, npmDir+'/datatables.net/js/jquery.dataTables.js'),
//'jquery-ui/ui/widgets/menu': path.resolve(__dirname, npmDir+'/jquery-ui/ui/widgets/menu.js'),
//'simplemde': path.resolve(__dirname, npmDir+'/simplemde/dist/simplemde.min.js'),
//'papaparse': path.resolve(__dirname, npmDir+'/papaparse/papaparse.min.js'),
//'markdown-it-underline': path.resolve(__dirname, npmDir+'/markdown-it-underline/index.js'),
'render-md': path.resolve(__dirname, assetsDir+'/js/cftree/render-md.js'),
'util-salt': path.resolve(__dirname, assetsDir+'/js/util-salt.js'),
'ajaxq': path.resolve(__dirname, npmDir+'/ajaxq/ajaxq.js')
};
config.resolve.modules = [
'node_modules',
.copyFiles({
from: `./assets/${name}/img`,
to: 'img/[path][name].[ext]',
}, {
from: upath.joinSafe(vendorUiPath, 'Resources/private/img'),
to: 'img/[path][name].[ext]',
})
.configureFilenames({
js: 'js/[name].[hash:8].js',
css: 'css/[name].[hash:8].css',
images: 'img/[name].[hash:8].[ext]',
fonts: 'font/[name].[hash:8].[ext]'
});
;
const config = Encore.getWebpackConfig();
config.name = name;
config.resolve.alias = {
'~': path.resolve(__dirname, '../../')
};
Encore.reset();
return config;
};
module.exports = build;
.addEntry('js/recaptcha', './src/Intracto/SecretSantaBundle/Resources/public/js/recaptcha.js')
.addStyleEntry('css/main', [
'./src/Intracto/SecretSantaBundle/Resources/public/scss/main.scss',
'jquery-ui/themes/base/core.css',
'jquery-ui/themes/base/sortable.css',
])
.addStyleEntry('css/update', './src/Intracto/SecretSantaBundle/Resources/public/css/update.css')
.addStyleEntry('css/report', './src/Intracto/SecretSantaBundle/Resources/public/css/report.css')
.addStyleEntry('css/mediaqueries', './src/Intracto/SecretSantaBundle/Resources/public/css/mediaqueries.css')
.enableSourceMaps(!Encore.isProduction())
;
var config = Encore.getWebpackConfig();
config.resolve = {
alias: {
'@': path.resolve(__dirname, 'src/Intracto/SecretSantaBundle/Resources/public/'),
AppConfig: path.resolve(__dirname, 'app/config/'),
}
};
module.exports = config;