diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/angular.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/angular.spec.ts.snap index f3b4c2d99..a72d22121 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/angular.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/angular.spec.ts.snap @@ -166,6 +166,12 @@ exports[`angular configuration for android 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -398,6 +404,12 @@ exports[`angular configuration for ios 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap index 1b61257d6..daf3ae139 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/javascript.spec.ts.snap @@ -32,7 +32,8 @@ exports[`javascript configuration for android 1`] = ` '.android.scss', '.scss', '.android.json', - '.json' + '.json', + '.xml' ] }, resolveLoader: { @@ -170,6 +171,12 @@ exports[`javascript configuration for android 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -216,10 +223,14 @@ exports[`javascript configuration for android 1`] = ` ), /* config.plugin('WatchStatePlugin') */ new WatchStatePlugin(), + /* config.plugin('ContextExclusionPluginPlugin') */ + new ContextExclusionPlugin( + /__virtual_entry__\\\\.js$/ + ), /* config.plugin('VirtualModulesPlugin') */ new VirtualModulesPlugin( { - '__jest__/src/__virtual_entry__.js': 'require(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js)$/);\\\\nglobal.registerWebpackModules(context);' + '__jest__/src/__virtual_entry__.js': 'require(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);' } ) ], @@ -265,7 +276,8 @@ exports[`javascript configuration for ios 1`] = ` '.ios.scss', '.scss', '.ios.json', - '.json' + '.json', + '.xml' ] }, resolveLoader: { @@ -403,6 +415,12 @@ exports[`javascript configuration for ios 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -449,10 +467,14 @@ exports[`javascript configuration for ios 1`] = ` ), /* config.plugin('WatchStatePlugin') */ new WatchStatePlugin(), + /* config.plugin('ContextExclusionPluginPlugin') */ + new ContextExclusionPlugin( + /__virtual_entry__\\\\.js$/ + ), /* config.plugin('VirtualModulesPlugin') */ new VirtualModulesPlugin( { - '__jest__/src/__virtual_entry__.js': 'require(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js)$/);\\\\nglobal.registerWebpackModules(context);' + '__jest__/src/__virtual_entry__.js': 'require(\\\\'@nativescript/core/bundle-entry-points\\\\')\\\\nconst context = require.context(\\"~/\\", /* deep: */ true, /* filter: */ /.(xml|js|s?css)$/);\\\\nglobal.registerWebpackModules(context);' } ) ], diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/react.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/react.spec.ts.snap index 1f3045790..fbad90df5 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/react.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/react.spec.ts.snap @@ -175,6 +175,12 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -408,6 +414,12 @@ exports[`react configuration > android > base config 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -641,6 +653,12 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -877,6 +895,12 @@ exports[`react configuration > ios > base config 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/svelte.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/svelte.spec.ts.snap index 7c6911b64..1d8b8ac90 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/svelte.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/svelte.spec.ts.snap @@ -190,6 +190,12 @@ exports[`svelte configuration for android 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -436,6 +442,12 @@ exports[`svelte configuration for ios 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { diff --git a/packages/webpack5/__tests__/configuration/__snapshots__/vue.spec.ts.snap b/packages/webpack5/__tests__/configuration/__snapshots__/vue.spec.ts.snap index e0498ffb8..7790c124a 100644 --- a/packages/webpack5/__tests__/configuration/__snapshots__/vue.spec.ts.snap +++ b/packages/webpack5/__tests__/configuration/__snapshots__/vue.spec.ts.snap @@ -192,6 +192,12 @@ exports[`vue configuration for android 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'android' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { @@ -440,6 +446,12 @@ exports[`vue configuration for ios 1`] = ` verbose: false } ), + /* config.plugin('PlatformSuffixPlugin') */ + new PlatformSuffixPlugin( + { + platform: 'ios' + } + ), /* config.plugin('DefinePlugin') */ new DefinePlugin( { diff --git a/packages/webpack5/__tests__/configuration/javascript.spec.ts b/packages/webpack5/__tests__/configuration/javascript.spec.ts index 76a2c6201..dcafbafc6 100644 --- a/packages/webpack5/__tests__/configuration/javascript.spec.ts +++ b/packages/webpack5/__tests__/configuration/javascript.spec.ts @@ -1,4 +1,3 @@ -// @ts-ignore import Config from 'webpack-chain'; import javascript from '../../src/configuration/javascript'; import { init } from '../../src'; diff --git a/packages/webpack5/__tests__/configuration/svelte.spec.ts b/packages/webpack5/__tests__/configuration/svelte.spec.ts index 24eaf15e3..b835cacba 100644 --- a/packages/webpack5/__tests__/configuration/svelte.spec.ts +++ b/packages/webpack5/__tests__/configuration/svelte.spec.ts @@ -1,6 +1,7 @@ import Config from 'webpack-chain'; import svelte from '../../src/configuration/svelte'; import { init } from '../../src'; +import { mockFile } from '../../scripts/jest.mockFiles'; mockFile('./svelte.config.js', ''); // jest.mock('__jest__/svelte.config.js', () => { diff --git a/packages/webpack5/__tests__/index.spec.ts b/packages/webpack5/__tests__/index.spec.ts index 456780fdb..22cc9e2d3 100644 --- a/packages/webpack5/__tests__/index.spec.ts +++ b/packages/webpack5/__tests__/index.spec.ts @@ -42,7 +42,7 @@ describe('@nativescript/webpack', () => { lastCalled = true; expect(config.normal).toBe(true); }); - webpack.chainWebpack(chainFnLast, { last: true }); + webpack.chainWebpack(chainFnLast, { order: 10 }); const chainFnNormal = jest.fn((config) => { config.normal = true; @@ -55,6 +55,22 @@ describe('@nativescript/webpack', () => { webpack.resolveChainableConfig(); }); + it('prints plugin name that errored out', () => { + webpack.useConfig(false); + webpack.setCurrentPlugin('test-plugin'); + const chainFn = jest.fn(() => { + throw new Error('something wrong'); + }); + webpack.chainWebpack(chainFn); + + // should not throw + expect(() => webpack.resolveChainableConfig()).not.toThrow(); + + expect( + 'Unable to apply chain function from: test-plugin' + ).toHaveBeenWarned(); + }); + it('applies merge configs', () => { const dummyEnv = { env: true }; webpack.init(dummyEnv); diff --git a/packages/webpack5/jest.config.js b/packages/webpack5/jest.config.js index d0d1e8abd..6cc6b67ae 100644 --- a/packages/webpack5/jest.config.js +++ b/packages/webpack5/jest.config.js @@ -1,15 +1,16 @@ module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', + preset: 'ts-jest', + testEnvironment: 'node', moduleNameMapper: { - '^@nativescript/webpack$': '/src' + '^@nativescript/webpack$': '/src' }, setupFiles: [ - '/jest.setup.ts' + '/scripts/jest.setup.ts' + ], + setupFilesAfterEnv: [ + '/scripts/jest.mockWarn.ts' ], globals: { - 'ts-jest': { - tsconfig: 'tsconfig.jest.json' - } + __TEST__: true, } }; diff --git a/packages/webpack5/jest.setup.ts b/packages/webpack5/jest.setup.ts deleted file mode 100644 index cb63213d2..000000000 --- a/packages/webpack5/jest.setup.ts +++ /dev/null @@ -1,85 +0,0 @@ -// define our global helpers -declare global { - function mockFile(path: string, content: string); -} - -// enable TEST mode -global.__TEST__ = true; - -// we are mocking the cwd for the tests, since webpack needs absolute paths -// and we don't want them in tests -import dedent from 'ts-dedent'; - -process.cwd = () => '__jest__'; - -// a virtual mock for package.json -jest.mock( - '__jest__/package.json', - () => ({ - main: 'src/app.js', - devDependencies: { - typescript: '*', - }, - }), - { virtual: true } -); - -jest.mock('cosmiconfig', () => ({ - cosmiconfigSync(moduleName) { - return { - search() { - // no-op in tests - return null; - }, - }; - }, -})); - -jest.mock('path', () => { - const path = jest.requireActual('path'); - return { - ...path, - resolve(...args) { - if (args[0] === '__jest__') { - return path.join(...args); - } - - const resolved = path.resolve(...args); - if (resolved.includes('__jest__')) { - const li = resolved.lastIndexOf('__jest__'); - return resolved.substr(li); - } - - return resolved; - }, - }; -}); - -const mockedFiles: { [path: string]: string } = {}; - -global.mockFile = function mockFile(path, content) { - const unionFS = require('unionfs').default; - const Volume = require('memfs').Volume; - - // reset to fs - unionFS.reset(); - - // add mocked file - mockedFiles[path] = dedent(content); - - // create new volume - const vol = Volume.fromJSON(mockedFiles, '__jest__'); - - // use the new volume - unionFS.use(vol as any); -}; - -jest.mock('fs', () => { - const fs = jest.requireActual('fs'); - const unionFS = require('unionfs').default; - unionFS.reset = () => { - unionFS.fss = [fs]; - }; - - return unionFS.use(fs); -}); diff --git a/packages/webpack5/package.json b/packages/webpack5/package.json index 17ac378c8..c36817571 100644 --- a/packages/webpack5/package.json +++ b/packages/webpack5/package.json @@ -11,12 +11,11 @@ }, "license": "Apache-2.0", "scripts": { - "build": "tsc", + "build": "tsc --project tsconfig.build.json", "test": "jest", "prepack": "npm run build && cp -R src/stubs dist/stubs && chmod +x dist/bin/index.js" }, "dependencies": { - "@babel/core": "^7.12.3", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", "@types/sax": "^1.2.1", "babel-loader": "^8.2.1", @@ -57,6 +56,7 @@ "@types/terser-webpack-plugin": "^5.0.2", "@types/webpack-virtual-modules": "^0.1.0", "jest": "^26.6.3", + "jest-matcher-utils": "^26.6.2", "memfs": "^3.2.0", "nativescript-vue-template-compiler": "^2.8.2", "ts-jest": "^26.4.4", diff --git a/packages/webpack5/scripts/jest.globals.d.ts b/packages/webpack5/scripts/jest.globals.d.ts new file mode 100644 index 000000000..07e2a0691 --- /dev/null +++ b/packages/webpack5/scripts/jest.globals.d.ts @@ -0,0 +1,12 @@ +// define test-specific globals here + +declare namespace jest { + interface Matchers { + toHaveBeenWarned(): R; + toHaveBeenPrinted(): R; + } +} + +declare global { + function mockFile(path: string, content: string); +} diff --git a/packages/webpack5/scripts/jest.mockFiles.ts b/packages/webpack5/scripts/jest.mockFiles.ts new file mode 100644 index 000000000..ac61a943a --- /dev/null +++ b/packages/webpack5/scripts/jest.mockFiles.ts @@ -0,0 +1,42 @@ +import dedent from 'ts-dedent'; + +const mockedFiles: { [path: string]: string } = {}; + +export function mockFile(path, content) { + const unionFS = require('unionfs').default; + const Volume = require('memfs').Volume; + + // reset to fs + unionFS.reset(); + + // add mocked file + mockedFiles[path] = dedent(content); + + // create new volume + const vol = Volume.fromJSON(mockedFiles, '__jest__'); + + // use the new volume + unionFS.use(vol as any); +} + +// a virtual mock for package.json +jest.mock( + '__jest__/package.json', + () => ({ + main: 'src/app.js', + devDependencies: { + typescript: '*', + }, + }), + { virtual: true } +); + +jest.mock('fs', () => { + const fs = jest.requireActual('fs'); + const unionFS = require('unionfs').default; + unionFS.reset = () => { + unionFS.fss = [fs]; + }; + + return unionFS.use(fs); +}); diff --git a/packages/webpack5/scripts/jest.mockWarn.ts b/packages/webpack5/scripts/jest.mockWarn.ts new file mode 100644 index 000000000..161ad31ce --- /dev/null +++ b/packages/webpack5/scripts/jest.mockWarn.ts @@ -0,0 +1,64 @@ +import { printExpected, printReceived } from 'jest-matcher-utils'; +import dedent from 'ts-dedent'; + +expect.extend({ + toHaveBeenWarned(received: string) { + asserted.add(received); + const passed = warnSpy.mock.calls + .map((args) => args[1]) + .some((arg) => arg.indexOf(received) > -1); + if (passed) { + return { + pass: true, + message() { + return `expected ${printReceived(received)} not to have been warned`; + }, + }; + } + + const warnings = warnSpy.mock.calls.map((args) => args[1]).join('\n\n'); + return { + pass: false, + message() { + return dedent` + expected ${printExpected(received)} to have been warned. + + Actual warnings: + + ${warnings} + `; + }, + }; + }, +}); + +let warnSpy: any; +let asserted = new Set([]); +beforeEach(() => { + asserted.clear(); + + warnSpy = jest.spyOn(console, 'warn'); + + warnSpy.mockImplementation(() => {}); +}); + +afterEach(() => { + const assertedArray = Array.from(asserted); + const nonAssertedWarns = warnSpy.mock.calls + .map((args) => args[1]) + .filter((received) => { + return !assertedArray.some((assertedMessage) => { + return received.indexOf(assertedMessage) > -1; + }); + }); + + warnSpy.mockRestore(); + + if (nonAssertedWarns.length) { + throw new Error(dedent` + Test case printed unexpected warnings: + + ${printReceived(nonAssertedWarns.join('\n\n'))} + `); + } +}); diff --git a/packages/webpack5/scripts/jest.setup.ts b/packages/webpack5/scripts/jest.setup.ts new file mode 100644 index 000000000..3928cb8d0 --- /dev/null +++ b/packages/webpack5/scripts/jest.setup.ts @@ -0,0 +1,35 @@ +import './jest.mockFiles'; +// we are mocking the cwd for the tests, since webpack needs absolute paths +// and we don't want them in tests +process.cwd = () => '__jest__'; + +jest.mock('cosmiconfig', () => ({ + cosmiconfigSync(moduleName) { + return { + search() { + // no-op in tests + return null; + }, + }; + }, +})); + +jest.mock('path', () => { + const path = jest.requireActual('path'); + return { + ...path, + resolve(...args) { + if (args[0] === '__jest__') { + return path.join(...args); + } + + const resolved = path.resolve(...args); + if (resolved.includes('__jest__')) { + const li = resolved.lastIndexOf('__jest__'); + return resolved.substr(li); + } + + return resolved; + }, + }; +}); diff --git a/packages/webpack5/src/helpers/externalConfigs.ts b/packages/webpack5/src/helpers/externalConfigs.ts index 2231817a9..68b4be5d6 100644 --- a/packages/webpack5/src/helpers/externalConfigs.ts +++ b/packages/webpack5/src/helpers/externalConfigs.ts @@ -1,8 +1,10 @@ import path from 'path'; import fs from 'fs'; -import * as lib from '../index'; -import { error, info, warn } from './log'; + import { getAllDependencies, getDependencyPath } from './dependencies'; +import { info, warn } from './log'; +import * as lib from '../index'; +import { clearCurrentPlugin, setCurrentPlugin } from '../index'; export function applyExternalConfigs() { getAllDependencies().forEach((dependency) => { @@ -11,7 +13,7 @@ export function applyExternalConfigs() { if (fs.existsSync(configPath)) { info(`Discovered config: ${configPath}`); - + setCurrentPlugin(dependency); try { const externalConfig = require(configPath); @@ -27,14 +29,13 @@ export function applyExternalConfigs() { ); } } catch (err) { - error( - ` - Unable to apply config: ${configPath}. - Error is: - `, - err - ); + warn(` + Unable to apply config: ${configPath}. + Error is: ${err} + `); } } }); + + clearCurrentPlugin(); } diff --git a/packages/webpack5/src/helpers/log.ts b/packages/webpack5/src/helpers/log.ts index 26dd6a703..3fe9783e8 100644 --- a/packages/webpack5/src/helpers/log.ts +++ b/packages/webpack5/src/helpers/log.ts @@ -11,7 +11,7 @@ function cleanup(data: any[]) { } export function error(...data: any): Error { - console.error(`[@nativescript/webpack] Error: \n`, ...cleanup(data)); + console.warn(`[@nativescript/webpack] Error: \n`, ...cleanup(data)); // we return the error - the caller can throw or ignore if (typeof data[0] === 'string') { @@ -26,7 +26,7 @@ export function warn(...data: any): void { } export function info(...data: any): void { - console.info(`[@nativescript/webpack] Info: \n`, ...cleanup(data)); + console.log(`[@nativescript/webpack] Info: \n`, ...cleanup(data)); } // todo: refine diff --git a/packages/webpack5/src/index.ts b/packages/webpack5/src/index.ts index e6b51875a..731c70b27 100644 --- a/packages/webpack5/src/index.ts +++ b/packages/webpack5/src/index.ts @@ -30,20 +30,36 @@ export interface IWebpackEnv { // todo: add others } -let webpackChains = { - base: [], - normal: [], - last: [], -}; +interface IChainEntry { + chainFn: any; + order?: number; + plugin?: string; +} + +let webpackChains: IChainEntry[] = []; let webpackMerges: any[] = []; let explicitUseConfig = false; let hasInitialized = false; - +let currentPlugin: string | undefined; /** * @internal */ export let env: IWebpackEnv = {}; +/** + * @internal + */ +export function setCurrentPlugin(plugin: string) { + currentPlugin = plugin; +} + +/** + * @internal + */ +export function clearCurrentPlugin() { + currentPlugin = undefined; +} + ////// PUBLIC API export const defaultConfigs = configs; export const Utils = helpers; @@ -58,16 +74,22 @@ export function init(_env: IWebpackEnv) { export function useConfig(config: keyof typeof defaultConfigs | false) { explicitUseConfig = true; if (config) { - webpackChains.base.push(configs[config]); + webpackChains.push({ + order: -1, + chainFn: configs[config], + }); } } export function chainWebpack( chainFn: (config: Config, env: IWebpackEnv) => any, - options?: { last?: boolean } + options?: { order?: number } ) { - const type = options?.last ? 'last' : 'normal'; - webpackChains[type].push(chainFn); + webpackChains.push({ + order: options?.order || 0, + chainFn, + plugin: currentPlugin, + }); } export function mergeWebpack( @@ -90,19 +112,24 @@ export function resolveChainableConfig(): Config { // todo: allow opt-out applyExternalConfigs(); - const applyChains = (chains) => { - // this applies the chain configs - chains.forEach((chainFn) => { - return chainFn(config, env); + webpackChains + .splice(0) + .sort((a, b) => { + return a.order - b.order; + }) + .forEach(({ chainFn, plugin }) => { + try { + chainFn(config, env); + } catch (err) { + if (plugin) { + // print error with plugin name that causes it + error(` + Unable to apply chain function from: ${plugin}. + Error is: ${err} + `); + } + } }); - }; - - // first we apply base configs - applyChains(webpackChains.base); - // then regular configs - applyChains(webpackChains.normal); - // finally configs that opted to be called last - applyChains(webpackChains.last); if (env.verbose) { info('Resolved chainable config (before merges):'); diff --git a/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts b/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts index 183d48c0f..a9e54e86c 100644 --- a/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts +++ b/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts @@ -29,6 +29,7 @@ export class PlatformSuffixPlugin { ); const platformRE = new RegExp(`\.${this.platform}\.`); + // require.context compiler.hooks.contextModuleFactory.tap(id, (cmf) => { cmf.hooks.alternativeRequests.tap(id, (modules, options) => { const additionalModules = []; diff --git a/packages/webpack5/tsconfig.build.json b/packages/webpack5/tsconfig.build.json new file mode 100644 index 000000000..6d90f5603 --- /dev/null +++ b/packages/webpack5/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "include": ["src"] +} diff --git a/packages/webpack5/tsconfig.jest.json b/packages/webpack5/tsconfig.jest.json deleted file mode 100644 index e3a2a33ad..000000000 --- a/packages/webpack5/tsconfig.jest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src", "__tests__", "jest.setup.ts"] -} diff --git a/packages/webpack5/tsconfig.json b/packages/webpack5/tsconfig.json index f56902cf4..57f24b976 100644 --- a/packages/webpack5/tsconfig.json +++ b/packages/webpack5/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "rootDir": "./src", + "rootDir": ".", "baseUrl": ".", "target": "es2017", "module": "commonjs", @@ -20,6 +20,6 @@ "allowSyntheticDefaultImports": true, "stripInternal": true }, - "include": ["src"], + "include": ["src", "scripts", "__tests__"], "exclude": ["node_modules"] }