var Encore = require('@symfony/webpack-encore'); const webpack = require('webpack'); const TerserJsPlugin = require('terser-webpack-plugin'); // const CopyWebpackPlugin = require('copy-webpack-plugin'); Encore // .configureRuntimeEnvironment('dev-server') .configureRuntimeEnvironment('dev-server', { keepPublicPath: true, https: true, }) // directory where compiled assets will be stored .setOutputPath('./src/Resources/public/build/') // public path used by the web server to access the output path .setPublicPath('./') // only needed for CDN's or sub-directory deploy .setManifestKeyPrefix('bundles/payment') /* * 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('materianote', './assets/materialnote/materialnote.js') .addEntry('materianote-fr', './assets/materialnote/lang/materialnote-fr-FR.js') // allow legacy applications to use $/jQuery as a global variable // permets d'accéder de partout au $ de jquery .addLoader({ test: require.resolve('jquery'), use: [{ loader: 'expose-loader', options: 'jQuery' }, { loader: 'expose-loader', options: '$' }] }) .addLoader({ test: require.resolve('materialize-css'), use: [{ loader: 'expose-loader', options: 'Materialize' }] }) .autoProvidejQuery() .autoProvideVariables({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', "window.Moment": require.resolve('moment'), "window.DataTable": require.resolve('datatables.net'), // "window.$": require.resolve('jQuery'), }) // .addPlugin(new CopyWebpackPlugin([ // { from: './assets/imge', to: 'img' } // ])) // will require an extra script tag for runtime.js // but, you probably want this, unless you're building a single-page app .enableSingleRuntimeChunk() .splitEntryChunks() /* * 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()) // allow sass/scss files to be processed .enableSassLoader(function (sassOptions){}, { resolveUrlLoader:false }) // uncomment if you use TypeScript //.enableTypeScriptLoader() // 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') ; // create hashed filenames (e.g. app.abc123.css) // .enableVersioning() ///* const webpackConfig = Encore.getWebpackConfig(); // Add the new one webpackConfig.plugins.push(new TerserJsPlugin()); // Add the new one // webpackConfig.plugins.push(new UglifyJsPlugin()); // export the final configuration module.exports = webpackConfig;