%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/
Upload File :
Create Path :
Current File : /var/www/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/webpack.config.js

// const localDomain = 'http://maraton-localhost.local/';
const remoteDomain = 'https://maraton.eco-n-tech.co.uk/';
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
 
module.exports = {
	entry: {
		app: './src/js/app.js',
		admin: './src/js/admin.js',
	},
	output: {
		path: path.resolve(__dirname, 'dist'),
		filename: '[name].js',
		environment: {
			arrowFunction: false,
			bigIntLiteral: false,
			const: false,
			destructuring: false,
			dynamicImport: false,
			forOf: false,
			module: false,
		},
	},
	module: {
		rules: [
			{
				test: /\.(scss|css)$/,
				use: [
				process.env.NODE_ENV !== 'production'
				? 'style-loader'
				: MiniCssExtractPlugin.loader,
				'css-loader',
				{
					loader: "postcss-loader",
					options: {
					  postcssOptions: {
						plugins: [
						  [
							"autoprefixer",
							{
							  // Options
							},
						  ],
						],
					  },
					},
				},
				{
					loader: 'sass-loader',
					options: {
						sourceMap: true
					}
				},				
				{loader: 'import-glob-loader'}
				
				]
			},

			{
				test: /\.m?js$/,
				exclude: /(node_modules|bower_components)/,
				use: {
					loader: 'babel-loader',
					options: {
					presets: ['@babel/preset-env', '@babel/preset-react'],
					plugins: ['@babel/plugin-transform-arrow-functions']
					}
				}
			}
		  
		],
	},
	plugins: [
		new CleanWebpackPlugin(),
		new MiniCssExtractPlugin(),
		new CopyPlugin({
			patterns: [{ from: 'src/img', to: 'img' }]
		}),
		new BrowserSyncPlugin({
			files: ['**/*.twig', '**/*.php', 'dist/*.*'],
	  		proxy: remoteDomain,
			injectCss: true,
			serveStatic: [
				{
					route: '/wp-content/themes/maraton/dist',
					dir: './dist'
				}
			],
		}, { reload: false, }),
	]
};

Zerion Mini Shell 1.0