diff --git a/samples/grids/pivot-grid/styling/.prettierrc b/samples/grids/pivot-grid/styling/.prettierrc
new file mode 100644
index 000000000..15a7c7c6c
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/.prettierrc
@@ -0,0 +1,11 @@
+{
+ "printWidth": 250,
+ "tabWidth": 4,
+ "useTabs": false,
+ "semi": true,
+ "singleQuote": false,
+ "trailingComma": "none",
+ "bracketSpacing": true,
+ "jsxBracketSameLine": false,
+ "fluid": false
+}
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/ReadMe.md b/samples/grids/pivot-grid/styling/ReadMe.md
new file mode 100644
index 000000000..64b194a15
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/ReadMe.md
@@ -0,0 +1,56 @@
+
+
+
+This folder contains implementation of Web Components application with example of Styling feature using [Pivot Grid](https://infragistics.com/webcomponentssite/components/general-getting-started.html) component.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Branches
+
+> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-angular-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-angular-examples/tree/vnext) branch only when you want to contribute new samples to this repository.
+
+## Instructions
+
+To set up this project locally, execute these commands:
+
+```
+git clone https://github.com/IgniteUI/igniteui-wc-examples.git
+git checkout master
+cd ./igniteui-wc-examples
+cd ./samples/grids/pivot-grid/styling
+```
+
+open above folder in VS Code or type:
+```
+code .
+```
+
+In terminal window, run:
+
+```
+npm install
+npm run start
+```
+
+Then open http://localhost:4200/ in your browser
+
+
+## Learn More
+
+To learn more about **Ignite UI for Web Components**, check out the [Web Components documentation](https://infragistics.com/webcomponentssite/components/general-getting-started.html).
diff --git a/samples/grids/pivot-grid/styling/index.html b/samples/grids/pivot-grid/styling/index.html
new file mode 100644
index 000000000..97233fe19
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/index.html
@@ -0,0 +1,34 @@
+
+
+
+
+ Sample | Ignite UI | Web Components | infragistics
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <% if (false) { %>
+
+ <% } %>
+
+
+
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/package.json b/samples/grids/pivot-grid/styling/package.json
new file mode 100644
index 000000000..845cbac8b
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "example-ignite-ui-web-components",
+ "description": "This project provides example of using Ignite UI for Web Components",
+ "author": "Infragistics",
+ "version": "1.0.0",
+ "license": "",
+ "private": true,
+ "homepage": ".",
+ "main": "src/index.ts",
+ "scripts": {
+ "build": "npm run build:prod",
+ "build:dev": "webpack --mode development --config ./webpack.config.js --progress --color --display-error-details",
+ "build:prod": "webpack --env.NODE_ENV=production --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
+ "serve:dev": "node --max-old-space-size=8192 node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode development --config ./webpack.config.js --hot --progress --open",
+ "serve:prod": "webpack-dev-server --env.NODE_ENV=production --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --progress --open --content-base dist/",
+ "start": "npm run serve:dev",
+ "build:legacy": "npm run build:prod:legacy",
+ "build:dev:legacy": "webpack --env.legacy=true --mode development --config ./webpack.config.js --progress --color --display-error-details",
+ "build:prod:legacy": "webpack --env.NODE_ENV=production --env.legacy=true --mode production --config ./webpack.config.js --progress --color --display-error-details --bail",
+ "serve:dev:legacy": "node --max-old-space-size=8192 node_modules/webpack-dev-server/bin/webpack-dev-server.js --env.legacy=true --mode development --config ./webpack.config.js --hot --progress --open",
+ "serve:prod:legacy": "webpack-dev-server --env.NODE_ENV=production --env.legacy=true --mode production --config ./webpack.config.js --port 3000 --host 0.0.0.0 --hot --progress --open --content-base dist/",
+ "start:legacy": "npm run serve:dev:legacy"
+ },
+ "dependencies": {
+ "@webcomponents/custom-elements": "^1.4.1",
+ "@webcomponents/template": "^1.4.2",
+ "babel-runtime": "^6.26.0",
+ "core-js": "^3.6.5",
+ "igniteui-webcomponents-core": "7.1.0",
+ "igniteui-webcomponents-grids": "^7.0.0",
+ "igniteui-webcomponents-inputs": "7.1.0",
+ "igniteui-webcomponents-layouts": "7.1.0",
+ "lit-html": "^3.3.1",
+ "tslib": "^2.8.1"
+ },
+ "devDependencies": {
+ "@babel/cli": "^7.28.3",
+ "@babel/core": "^7.28.4",
+ "@babel/plugin-transform-class-properties": "^7.27.1",
+ "@babel/plugin-transform-class-static-block": "^7.28.3",
+ "@babel/plugin-transform-runtime": "^7.28.3",
+ "@babel/preset-env": "^7.28.3",
+ "@babel/preset-typescript": "^7.27.1",
+ "@types/source-map": "^0.5.7",
+ "babel-loader": "^10.0.0",
+ "babel-plugin-transform-custom-element-classes": "^0.1.0",
+ "css-loader": "^7.1.2",
+ "csv-loader": "^3.0.5",
+ "file-loader": "^6.2.0",
+ "fork-ts-checker-webpack-plugin": "^9.1.0",
+ "html-webpack-plugin": "^5.6.4",
+ "parcel-bundler": "^1.12.5",
+ "source-map": "^0.7.6",
+ "style-loader": "^4.0.0",
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
+ "typescript": "^5.9.2",
+ "webpack": "^5.101.3",
+ "webpack-cli": "^6.0.1",
+ "webpack-dev-server": "^5.2.2",
+ "worker-loader": "^3.0.8",
+ "xml-loader": "^1.2.1"
+ }
+}
diff --git a/samples/grids/pivot-grid/styling/sandbox.config.json b/samples/grids/pivot-grid/styling/sandbox.config.json
new file mode 100644
index 000000000..5c5b54fe2
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/sandbox.config.json
@@ -0,0 +1,7 @@
+{
+ "infiniteLoopProtection": false,
+ "hardReloadOnChange": false,
+ "view": "browser",
+ "template": "parcel"
+}
+
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/src/PivotSalesData.ts b/samples/grids/pivot-grid/styling/src/PivotSalesData.ts
new file mode 100644
index 000000000..b4ed394f1
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/src/PivotSalesData.ts
@@ -0,0 +1,361 @@
+export class PivotSalesDataItem {
+ public constructor(init: Partial) {
+ Object.assign(this, init);
+ }
+
+ public Country: string;
+ public Product: string;
+ public UnitsSold: number;
+ public ManufacturingPrice: number;
+ public SalePrice: number;
+ public GrossSales: number;
+ public Discounts: number;
+ public Sales: number;
+ public COGS: number;
+ public Profit: number;
+ public Date: string;
+ public MonthName: string;
+ public Year: number;
+
+}
+export class PivotSalesData extends Array {
+ public constructor() {
+ super();
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `UK`,
+ Product: `Vermont`,
+ UnitsSold: 501,
+ ManufacturingPrice: 15,
+ SalePrice: 23,
+ GrossSales: 26440,
+ Discounts: null,
+ Sales: 26440,
+ COGS: 16185,
+ Profit: 11255,
+ Date: `1/1/20`,
+ MonthName: `January`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Japan`,
+ Product: `Kensington`,
+ UnitsSold: 1372,
+ ManufacturingPrice: 3,
+ SalePrice: 20,
+ GrossSales: 27440,
+ Discounts: null,
+ Sales: 27440,
+ COGS: 16185,
+ Profit: 11255,
+ Date: `1/1/20`,
+ MonthName: `January`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Kensington`,
+ UnitsSold: 2762,
+ ManufacturingPrice: 3,
+ SalePrice: 20,
+ GrossSales: 55240,
+ Discounts: null,
+ Sales: 55240,
+ COGS: 13210,
+ Profit: 42030,
+ Date: `1/1/20`,
+ MonthName: `January`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `UK`,
+ Product: `Kensington`,
+ UnitsSold: 1464,
+ ManufacturingPrice: 3,
+ SalePrice: 15,
+ GrossSales: 21960,
+ Discounts: null,
+ Sales: 21960,
+ COGS: 21780,
+ Profit: 180,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Kensington`,
+ UnitsSold: 719,
+ ManufacturingPrice: 3,
+ SalePrice: 15,
+ GrossSales: 10785,
+ Discounts: null,
+ Sales: 10785,
+ COGS: 8880,
+ Profit: 1905,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Brazil`,
+ Product: `Kensington`,
+ UnitsSold: 3576,
+ ManufacturingPrice: 3,
+ SalePrice: 15,
+ GrossSales: 53640,
+ Discounts: null,
+ Sales: 53640,
+ COGS: 24700,
+ Profit: 28940,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `USA`,
+ Product: `Vermont`,
+ UnitsSold: 3576,
+ ManufacturingPrice: 3,
+ SalePrice: 15,
+ GrossSales: 53640,
+ Discounts: null,
+ Sales: 53640,
+ COGS: 24700,
+ Profit: 28940,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Brazil`,
+ Product: `Vermont`,
+ UnitsSold: 3576,
+ ManufacturingPrice: 3,
+ SalePrice: 15,
+ GrossSales: 53640,
+ Discounts: null,
+ Sales: 53640,
+ COGS: 24700,
+ Profit: 28940,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Kensington`,
+ UnitsSold: 4422,
+ ManufacturingPrice: 3,
+ SalePrice: 350,
+ GrossSales: 1547700,
+ Discounts: null,
+ Sales: 1547700,
+ COGS: 393380,
+ Profit: 1154320,
+ Date: `12/1/20`,
+ MonthName: `December`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Royal Oak`,
+ UnitsSold: 3649,
+ ManufacturingPrice: 5,
+ SalePrice: 15,
+ GrossSales: 54735,
+ Discounts: null,
+ Sales: 54735,
+ COGS: 9210,
+ Profit: 45525,
+ Date: `3/1/20`,
+ MonthName: `March`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Japan`,
+ Product: `Royal Oak`,
+ UnitsSold: 4172,
+ ManufacturingPrice: 5,
+ SalePrice: 12,
+ GrossSales: 50064,
+ Discounts: null,
+ Sales: 50064,
+ COGS: 7554,
+ Profit: 42510,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `UK`,
+ Product: `Royal Oak`,
+ UnitsSold: 3841,
+ ManufacturingPrice: 5,
+ SalePrice: 20,
+ GrossSales: 76820,
+ Discounts: null,
+ Sales: 76820,
+ COGS: 18990,
+ Profit: 57830,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Royal Oak`,
+ UnitsSold: 3726,
+ ManufacturingPrice: 5,
+ SalePrice: 12,
+ GrossSales: 44712,
+ Discounts: null,
+ Sales: 44712,
+ COGS: 4635,
+ Profit: 40077,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Brazil`,
+ Product: `Royal Oak`,
+ UnitsSold: 2625,
+ ManufacturingPrice: 5,
+ SalePrice: 15,
+ GrossSales: 39375,
+ Discounts: null,
+ Sales: 39375,
+ COGS: 24700,
+ Profit: 14675,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Japan`,
+ Product: `Royal Oak`,
+ UnitsSold: 1958,
+ ManufacturingPrice: 5,
+ SalePrice: 125,
+ GrossSales: 244750,
+ Discounts: null,
+ Sales: 244750,
+ COGS: 319860,
+ Profit: 75110,
+ Date: `7/1/20`,
+ MonthName: `July`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Japan`,
+ Product: `Burlington`,
+ UnitsSold: 4307,
+ ManufacturingPrice: 250,
+ SalePrice: 300,
+ GrossSales: 1292100,
+ Discounts: null,
+ Sales: 1292100,
+ COGS: 500250,
+ Profit: 791850,
+ Date: `2/1/20`,
+ MonthName: `February`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `India`,
+ Product: `Burlington`,
+ UnitsSold: 3649,
+ ManufacturingPrice: 5,
+ SalePrice: 15,
+ GrossSales: 54735,
+ Discounts: null,
+ Sales: 54735,
+ COGS: 9210,
+ Profit: 45525,
+ Date: `3/1/20`,
+ MonthName: `March`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Japan`,
+ Product: `Burlington`,
+ UnitsSold: 4172,
+ ManufacturingPrice: 5,
+ SalePrice: 12,
+ GrossSales: 50064,
+ Discounts: null,
+ Sales: 50064,
+ COGS: 7554,
+ Profit: 42510,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `UK`,
+ Product: `Burlington`,
+ UnitsSold: 3841,
+ ManufacturingPrice: 5,
+ SalePrice: 20,
+ GrossSales: 76820,
+ Discounts: null,
+ Sales: 76820,
+ COGS: 18990,
+ Profit: 57830,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `Brazil`,
+ Product: `Burlington`,
+ UnitsSold: 4172,
+ ManufacturingPrice: 5,
+ SalePrice: 12,
+ GrossSales: 50064,
+ Discounts: null,
+ Sales: 50064,
+ COGS: 7554,
+ Profit: 42510,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ this.push(new PivotSalesDataItem(
+ {
+ Country: `USA`,
+ Product: `Burlington`,
+ UnitsSold: 3841,
+ ManufacturingPrice: 5,
+ SalePrice: 20,
+ GrossSales: 76820,
+ Discounts: null,
+ Sales: 76820,
+ COGS: 18990,
+ Profit: 57830,
+ Date: `6/1/20`,
+ MonthName: `June`,
+ Year: 2020
+ }));
+ }
+}
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/src/index.css b/samples/grids/pivot-grid/styling/src/index.css
new file mode 100644
index 000000000..755a4d226
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/src/index.css
@@ -0,0 +1,13 @@
+/* shared styles are loaded from: */
+/* https://dl.infragistics.com/x/css/samples/shared.v8.css */
+
+igc-pivot-grid {
+ --header-background: #3b3a3a;
+ --header-text-color: #ffcd0f;
+ --content-background: #494949;
+ --content-text-color: #ffcd0f;
+ --row-odd-background: #494949;
+ --row-even-background: #494949;
+ --row-hover-background: #3b3a3a;
+ --row-hover-text-color: #ffcd0f;
+}
diff --git a/samples/grids/pivot-grid/styling/src/index.ts b/samples/grids/pivot-grid/styling/src/index.ts
new file mode 100644
index 000000000..f7d94f7f1
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/src/index.ts
@@ -0,0 +1,69 @@
+import 'igniteui-webcomponents-grids/grids/combined';
+import { IgcPivotGridComponent, IgcPivotConfiguration, IgcPivotDimension, IgcPivotValue, IgcPivotAggregator } from 'igniteui-webcomponents-grids/grids';
+import { PivotSalesData } from './PivotSalesData';
+import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
+import "./index.css";
+
+export class Sample {
+
+ private grid: IgcPivotGridComponent
+ private _pivotConfiguration1: IgcPivotConfiguration | null = null;
+ public get pivotConfiguration1(): IgcPivotConfiguration {
+ if (this._pivotConfiguration1 == null)
+ {
+ var pivotConfiguration1: IgcPivotConfiguration = {} as IgcPivotConfiguration;
+
+ var pivotDimension1: IgcPivotDimension = {} as IgcPivotDimension;
+ pivotDimension1.memberName = "Product";
+ pivotDimension1.enabled = true;
+
+ pivotConfiguration1.rows = []
+ pivotConfiguration1.rows.push(pivotDimension1);
+ var pivotDimension2: IgcPivotDimension = {} as IgcPivotDimension;
+ pivotDimension2.memberName = "Country";
+ pivotDimension2.enabled = true;
+
+ pivotConfiguration1.columns = []
+ pivotConfiguration1.columns.push(pivotDimension2);
+ var pivotValue1: IgcPivotValue = {} as IgcPivotValue;
+ pivotValue1.member = "Sales";
+ pivotValue1.enabled = true;
+ pivotValue1.dataType = "currency";
+ var pivotAggregator1: IgcPivotAggregator = {} as IgcPivotAggregator;
+ pivotAggregator1.key = "SUM";
+ pivotAggregator1.aggregatorName = "SUM";
+
+ pivotValue1.aggregate = pivotAggregator1;
+
+ pivotConfiguration1.values = []
+ pivotConfiguration1.values.push(pivotValue1);
+
+ this._pivotConfiguration1 = pivotConfiguration1;
+ }
+ return this._pivotConfiguration1;
+ }
+
+ private _bind: () => void;
+
+ constructor() {
+ var grid = this.grid = document.getElementById('grid') as IgcPivotGridComponent;
+
+ this._bind = () => {
+ grid.pivotConfiguration = this.pivotConfiguration1
+ grid.data = this.pivotSalesData
+ }
+ this._bind();
+ }
+
+ private _pivotSalesData: PivotSalesData = null;
+ public get pivotSalesData(): PivotSalesData {
+ if (this._pivotSalesData == null)
+ {
+ this._pivotSalesData = new PivotSalesData();
+ }
+ return this._pivotSalesData;
+ }
+
+}
+
+new Sample();
diff --git a/samples/grids/pivot-grid/styling/tsconfig.json b/samples/grids/pivot-grid/styling/tsconfig.json
new file mode 100644
index 000000000..de23257dd
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "noImplicitReturns": true,
+ "esModuleInterop": true,
+ "noImplicitAny": true,
+ "declarationDir": "dist/types",
+ "moduleResolution": "node",
+ "declaration": true,
+ "target": "es2015",
+ "module": "es2015",
+ "strict": true
+ },
+ "include": [
+ "src/**/*"
+ ],
+ "exclude": [
+ "node_modules",
+ "dist"
+ ]
+}
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/tslint.json b/samples/grids/pivot-grid/styling/tslint.json
new file mode 100644
index 000000000..18e202b1f
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/tslint.json
@@ -0,0 +1,53 @@
+{
+ "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
+ "linterOptions": {
+ "exclude": [
+ "node_modules/**/*.ts",
+ "**/odatajs-4.0.0.js",
+ "src/images/*.*"
+ ]
+ },
+ "rules": {
+ "only-arrow-functions": false,
+ "jsx-self-close": false,
+ "jsx-wrap-multiline": false,
+ "no-var-requires": false,
+ "no-var": false,
+ "no-var-keyword": false,
+ "no-console": false,
+ "no-string-literal": false,
+ "no-unused-vars": false,
+ "@typescript-eslint/no-unused-vars": "off",
+ "jsx-no-lambda": false,
+ "ordered-imports": false,
+ "object-literal-sort-keys": false,
+ "object-literal-shorthand": false,
+ "member-ordering": false,
+ "curly": [false, "ignore-same-line"],
+ "max-classes-per-file": [true, 10],
+ "prefer-const": false,
+ "prefer-for-of": false,
+ "no-useless-constructor": false,
+ "@typescript-eslint/no-useless-constructor": "off",
+ "@typescript-eslint/type-annotation-spacing": "off"
+ },
+ "jsRules": {
+ "only-arrow-functions": false,
+ "jsx-self-close": false,
+ "jsx-wrap-multiline": false,
+ "no-var-requires": false,
+ "no-console": false,
+ "no-unused-vars": false,
+ "@typescript-eslint/no-unused-vars": "off",
+ "jsx-no-lambda": false,
+ "ordered-imports": false,
+ "object-literal-sort-keys": false,
+ "object-literal-shorthand": false,
+ "curly": [false, "ignore-same-line"],
+ "max-classes-per-file": [true, 10],
+ "prefer-const": false,
+ "prefer-for-of": false,
+ "no-useless-constructor": false,
+ "@typescript-eslint/no-useless-constructor": "off"
+ }
+ }
\ No newline at end of file
diff --git a/samples/grids/pivot-grid/styling/webpack.config.js b/samples/grids/pivot-grid/styling/webpack.config.js
new file mode 100644
index 000000000..3813144cf
--- /dev/null
+++ b/samples/grids/pivot-grid/styling/webpack.config.js
@@ -0,0 +1,107 @@
+const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
+const path = require('path');
+const webpack = require('webpack');
+
+module.exports = env => {
+ const nodeEnv = process.env.NODE_ENV || 'development';
+ const isProd = nodeEnv === 'production';
+ const isLegacy = !!process.env.legacy && !(process.env.legacy == "false");
+ console.log(">> webpack nodeEnv=" + nodeEnv);
+ console.log(">> webpack isProd=" + isProd);
+ console.log(">> webpack isLegacy=" + isLegacy);
+ const presets = [
+ ["@babel/preset-env", {
+ "useBuiltIns": "usage",
+ "corejs": 3,
+ "targets": {
+ "browsers": isLegacy ? ["defaults"] : [
+ "last 2 Chrome versions",
+ "last 2 Safari versions",
+ "last 2 iOS versions",
+ "last 2 Firefox versions",
+ "last 2 Edge versions"]
+ }
+ }],
+ "@babel/preset-typescript"
+ ];
+
+ return {
+ entry: isLegacy ? [
+ path.resolve(__dirname, 'node_modules/@webcomponents/custom-elements'),
+ path.resolve(__dirname, 'node_modules/@webcomponents/template'),
+ path.resolve(__dirname, 'src')
+ ] : path.resolve(__dirname, 'src'),
+ devtool: isProd ? false : 'source-map',
+ output: {
+ filename: isProd ? '[fullhash].bundle.js' : '[fullhash].bundle.js',
+ globalObject: 'this',
+ path: path.resolve(__dirname, 'dist'),
+ },
+
+ resolve: {
+ mainFields: ['esm2015', 'module', 'main'],
+ extensions: ['.ts', '.js', '.json'],
+ plugins: [new TsconfigPathsPlugin({
+ configFile: './tsconfig.json',
+ extensions: ['.ts', '.js'],
+ mainFields: ['esm2015', 'module', 'main']
+ })]
+ },
+
+ module: {
+ rules: [
+ { test: /\.(png|svg|jpg|gif)$/, use: ['file-loader'] },
+ { test: /\.(csv|tsv)$/, use: ['csv-loader'] },
+ { test: /\.xml$/, use: ['xml-loader'] },
+ { test: /\.css$/, sideEffects: true, use: ['style-loader', 'css-loader'] },
+ {
+ test: /worker\.(ts|js)$/,
+ use: [
+ { loader: 'worker-loader' },
+ {
+ loader: 'babel-loader', options: {
+ "compact": isProd ? true : false,
+ "presets": presets,
+ "plugins": [
+ "@babel/plugin-transform-class-static-block",
+ "@babel/plugin-transform-class-properties",
+ "@babel/plugin-transform-runtime"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ test: /\.(ts|js)$/, loader: 'babel-loader',
+ options: {
+ "compact": isProd ? true : false,
+ "presets": presets,
+ "plugins": [
+ "@babel/plugin-transform-class-static-block",
+ "@babel/plugin-transform-class-properties",
+ "@babel/plugin-transform-runtime"
+ ]
+ },
+ exclude:
+ function (modulePath) {
+ return /node_modules/.test(modulePath) &&
+ !/igniteui-webcomponents/.test(modulePath) &&
+ !/lit-html/.test(modulePath);
+ }
+ }],
+ },
+
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify(nodeEnv)
+ }),
+ new HtmlWebpackPlugin({
+ title: 'for-cs',
+ template: 'index.html'
+ }),
+ new ForkTsCheckerWebpackPlugin()
+ ]
+ };
+};