diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 21babef..bc0b04b 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -37,8 +37,6 @@ jobs: # and run all Cypress tests - name: Cypress run uses: cypress-io/github-action@v5 # use the explicit version number - env: - ENV: production with: component: true publish-npm: diff --git a/.github/workflows/npm-test.yml b/.github/workflows/npm-test.yml index 8f6ade1..66a7d24 100644 --- a/.github/workflows/npm-test.yml +++ b/.github/workflows/npm-test.yml @@ -43,8 +43,6 @@ jobs: # and run all Cypress tests - name: Cypress run uses: cypress-io/github-action@v5 # use the explicit version number - env: - ENV: production with: component: true test-build-package: diff --git a/webpack.cy.config.ts b/webpack.cy.config.ts index 9540050..9676086 100644 --- a/webpack.cy.config.ts +++ b/webpack.cy.config.ts @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs'; +import { config as envConfig } from './config'; import webpack from 'webpack'; -import * as dotenv from 'dotenv'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import { CleanWebpackPlugin } from 'clean-webpack-plugin'; @@ -11,7 +11,6 @@ import ESLintPlugin from 'eslint-webpack-plugin'; import CopyPlugin from 'copy-webpack-plugin'; import { resolveTsAliases } from 'resolve-ts-aliases'; -const dotEnvToParse = dotenv.config(); const alias = resolveTsAliases(path.resolve('tsconfig.json')); const copyPatterns: {from: string, to: string}[] = []; @@ -40,10 +39,10 @@ export default { new MiniCssExtractPlugin({ filename: 'index.css', }), - new webpack.DefinePlugin({ - 'process.env': JSON.stringify(dotEnvToParse.parsed), - }), new ESLintPlugin(), + new webpack.EnvironmentPlugin({ + ...envConfig, + }), new CopyPlugin({ patterns: copyPatterns }),