mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
const path = require("path");
|
|
const isProduction = process.env.NODE_ENV === "production";
|
|
|
|
const DependencyExtractionWebpackPlugin = require("@woocommerce/dependency-extraction-webpack-plugin");
|
|
|
|
module.exports = {
|
|
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
mode: isProduction ? "production" : "development",
|
|
target: "web",
|
|
plugins: [new DependencyExtractionWebpackPlugin()],
|
|
entry: {
|
|
"cart-paylater-block": path.resolve(
|
|
process.cwd(),
|
|
"resources",
|
|
"js",
|
|
"CartPayLaterMessagesBlock",
|
|
"cart-paylater-block.js"
|
|
),
|
|
"cart-paylater-block-inserter": path.resolve(
|
|
process.cwd(),
|
|
"resources",
|
|
"js",
|
|
"CartPayLaterMessagesBlock",
|
|
"cart-paylater-block-inserter.js"
|
|
),
|
|
"checkout-paylater-block": path.resolve(
|
|
process.cwd(),
|
|
"resources",
|
|
"js",
|
|
"CheckoutPayLaterMessagesBlock",
|
|
"checkout-paylater-block.js"
|
|
),
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, "assets/"),
|
|
filename: "js/[name].js",
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js?$/,
|
|
exclude: /node_modules/,
|
|
loader: "babel-loader",
|
|
options: {
|
|
presets: ["@babel/preset-env", "@babel/preset-react"],
|
|
},
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
exclude: /node_modules/,
|
|
use: [
|
|
{
|
|
loader: "file-loader",
|
|
options: {
|
|
name: "css/[name].css",
|
|
},
|
|
},
|
|
{ loader: "sass-loader" },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
};
|