Skip to content

Commit

Permalink
Merge pull request #13 from indigotree/bugfix/41170944/fix-sass-legac…
Browse files Browse the repository at this point in the history
…y-js-deprecation-error

Fix dart sass legacy js error
  • Loading branch information
paxjah authored Dec 16, 2024
2 parents e96015c + 2b26d78 commit 0d6c7aa
Showing 1 changed file with 70 additions and 64 deletions.
134 changes: 70 additions & 64 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,78 @@
const path = require("path");
const path = require('path');

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
const DependencyExtractionWebpackPlugin = require("@wordpress/dependency-extraction-webpack-plugin");
const WebpackRTLPlugin = require("@automattic/webpack-rtl-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin');
const WebpackRTLPlugin = require('@automattic/webpack-rtl-plugin');

const isDev = process.env.NODE_ENV !== "production";
const isDev = process.env.NODE_ENV !== 'production';

module.exports = {
mode: isDev ? "development" : "production",
stats: "minimal",
entry: {
index: path.join(process.cwd(), "src", "index.js"),
},
output: {
filename: "[name].js",
path: path.join(process.cwd(), "dist"),
publicPath: "",
},
externals: {
jquery: "jQuery",
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@wordpress/babel-preset-default"],
},
},
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [require("autoprefixer")(), require("postcss-flexbugs-fixes")],
},
mode: isDev ? 'development' : 'production',
stats: 'minimal',
entry: {
index: path.join(process.cwd(), 'src', 'index.js'),
},
output: {
filename: '[name].js',
path: path.join(process.cwd(), 'dist'),
publicPath: '',
},
externals: {
jquery: 'jQuery',
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@wordpress/babel-preset-default'],
},
},
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
require('autoprefixer')(),
require('postcss-flexbugs-fixes'),
],
},
},
},
{
loader: 'sass-loader',
options: {
api: 'modern',
},
},
],
},
{
test: /\.(png|jpe?g|gif|svg|webp|avif|woff2?|ttf|eot|otf)$/,
type: 'asset/resource',
generator: {
filename: '[contenthash][ext]',
},
},
},
{
loader: "sass-loader",
},
],
},
{
test: /\.(png|jpe?g|gif|svg|webp|avif|woff2?|ttf|eot|otf)$/,
type: "asset/resource",
generator: {
filename: "[contenthash][ext]",
},
},
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: 'chunk-[id].css',
}),
new DependencyExtractionWebpackPlugin(),
new WebpackManifestPlugin(),
new WebpackRTLPlugin(),
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "chunk-[id].css",
}),
new DependencyExtractionWebpackPlugin(),
new WebpackManifestPlugin(),
new WebpackRTLPlugin(),
],
};

0 comments on commit 0d6c7aa

Please sign in to comment.