%PDF- %PDF-
Direktori : /var/www/sms.eco-n-tech.co.uk/wp-content/themes/hittasmslanwebvatra/ |
Current File : /var/www/sms.eco-n-tech.co.uk/wp-content/themes/hittasmslanwebvatra/webpack.config.js |
const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); const devMode = process.env.NODE_ENV !== "production"; const TerserPlugin = require("terser-webpack-plugin"); module.exports = { entry: { // bootstrap: './src/js/bootstrap.min.js', app: './src/js/app.js', app_critical: './src/js/app-critical.js', page: './src/js/page/page.js', page_critical: './src/js/page/page-critical.js', page_index: './src/js/page/index.js', // page_index_critical: './src/js/page/index-critical.js', page_snabblan: './src/js/page/snabblan.js', // page_snabblan_critical: './src/js/page/snabblan-critical.js', page_snabblan_utan_uc: './src/js/page/snabblan_utan_uc.js', // page_snabblan_utan_uc_critical: './src/js/page/snabblan_utan_uc-critical.js', page_lan_utan_uc: './src/js/page/lan_utan_uc.js', // page_lan_utan_uc_critical: './src/js/page/lan_utan_uc-critical.js', // page_wwf: './src/js/page/wwf.js', page_wwf_critical: './src/js/page/wwf-critical.js', page_om_oss: './src/js/page/om_oss.js', page_om_oss_critical: './src/js/page/om_oss-critical.js', // langivare_index: './src/js/langivare/index.js', langivare_index_critical: './src/js/langivare/index-critical.js', langivare_show: './src/js/langivare/show.js', langivare_show_critical: './src/js/langivare/show-critical.js', // blog_index: './src/js/blog/index.js', blog_index_critical: './src/js/blog/index-critical.js', // blog_show: './src/js/blog/show.js', blog_show_critical: './src/js/blog/show-critical.js', }, output: { path: path.resolve(__dirname, 'dist'), filename: 'js/[name].js', environment: { arrowFunction: false, bigIntLiteral: false, const: false, destructuring: false, dynamicImport: false, forOf: false, module: false, }, }, module: { rules: [ { test: /\.(scss|less|css)$/, use: [ devMode ? 'style-loader' : MiniCssExtractPlugin.loader, 'css-loader', { loader: 'less-loader', options: { sourceMap: false } } ] }, { test: /\.jpg/, type: 'asset/resource' }, { test: /\.m?js$/, exclude: /(node_modules|bower_components)/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-transform-arrow-functions'] } } } ] }, plugins: [ new CleanWebpackPlugin(), new MiniCssExtractPlugin({ filename: 'css/[name].css', chunkFilename: '[id].css', }), new CopyPlugin({ patterns: [{ from: 'src/img', to: 'img' }] }), new BrowserSyncPlugin({ files: ['**/*.php', '**/*.twig', '**/*.html', 'dist/*.*'], // proxy: localDomain, injectCss: true, host: 'localhost', port: 3100, server: { baseDir: './' } }, { reload: false, }), ], optimization: { minimize: true, minimizer: [ new TerserPlugin(), new CssMinimizerPlugin({ minimizerOptions: { preset: [ "default", { discardComments: { removeAll: true }, }, ], }, }), ], }, };