@common-stack/generate-plugin 7.0.4-alpha.1 → 7.0.4-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/generators/add-fullstack/files/package.json +1 -1
  3. package/lib/generators/add-fullstack/files/rollup.config.base.mjs +45 -22
  4. package/lib/generators/add-fullstack/generator.cjs +7 -1
  5. package/lib/generators/add-fullstack/generator.cjs.map +1 -1
  6. package/lib/generators/add-fullstack/generator.mjs +7 -1
  7. package/lib/generators/add-fullstack/generator.mjs.map +1 -1
  8. package/lib/generators/add-fullstack/schema.d.ts +10 -0
  9. package/lib/generators/add-fullstack/updates/nxSetup.cjs +113 -57
  10. package/lib/generators/add-fullstack/updates/nxSetup.cjs.map +1 -1
  11. package/lib/generators/add-fullstack/updates/nxSetup.d.ts +1 -1
  12. package/lib/generators/add-fullstack/updates/nxSetup.mjs +113 -57
  13. package/lib/generators/add-fullstack/updates/nxSetup.mjs.map +1 -1
  14. package/lib/generators/add-package/files/browser/rollup.config.mjs +1 -1
  15. package/lib/generators/add-package/files/browser/tsconfig.json +15 -27
  16. package/lib/generators/add-package/files/client/rollup.config.mjs +30 -25
  17. package/lib/generators/add-package/files/client/tsconfig.json +13 -26
  18. package/lib/generators/add-package/files/core/rollup.config.mjs +33 -61
  19. package/lib/generators/add-package/files/core/tsconfig.json +12 -21
  20. package/lib/generators/add-package/files/server/rollup.config.mjs +31 -24
  21. package/lib/generators/add-package/files/server/tsconfig.json +15 -25
  22. package/lib/generators/add-package/generator.cjs +53 -11
  23. package/lib/generators/add-package/generator.cjs.map +1 -1
  24. package/lib/generators/add-package/generator.d.ts +4 -1
  25. package/lib/generators/add-package/generator.mjs +53 -11
  26. package/lib/generators/add-package/generator.mjs.map +1 -1
  27. package/package.json +2 -2
  28. package/src/generators/add-fullstack/files/package.json +1 -1
  29. package/src/generators/add-fullstack/files/rollup.config.base.mjs +45 -22
  30. package/src/generators/add-fullstack/generator.ts +8 -1
  31. package/src/generators/add-fullstack/schema.ts +10 -0
  32. package/src/generators/add-fullstack/updates/nxSetup.ts +123 -73
  33. package/src/generators/add-package/files/browser/rollup.config.mjs +1 -1
  34. package/src/generators/add-package/files/browser/tsconfig.json +15 -27
  35. package/src/generators/add-package/files/client/rollup.config.mjs +30 -25
  36. package/src/generators/add-package/files/client/tsconfig.json +13 -26
  37. package/src/generators/add-package/files/core/rollup.config.mjs +33 -61
  38. package/src/generators/add-package/files/core/tsconfig.json +12 -21
  39. package/src/generators/add-package/files/server/rollup.config.mjs +31 -24
  40. package/src/generators/add-package/files/server/tsconfig.json +15 -25
  41. package/src/generators/add-package/generator.ts +75 -17
  42. package/lib/generators/add-package/files/browser/webpack.config.js +0 -71
  43. package/lib/generators/add-package/files/client/webpack.config.js +0 -72
  44. package/lib/generators/add-package/files/core/webpack.config.js +0 -53
  45. package/src/generators/add-package/files/browser/webpack.config.js +0 -71
  46. package/src/generators/add-package/files/client/webpack.config.js +0 -72
  47. package/src/generators/add-package/files/core/webpack.config.js +0 -53
@@ -1,28 +1,16 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "resolveJsonModule": true,
6
- "rootDir": "src",
7
- "outDir": "lib",
8
- "declaration": true,
9
- "declarationDir": "lib",
10
- "types": [
11
- "@types/node",
12
- "@types/jest",
13
- "../../../typings",
14
- ],
15
- "skipLibCheck": true
16
- },
17
- "include": [
18
- "src"
19
- ],
20
- "exclude": [
21
- "../../../node_modules",
22
- "node_modules",
23
- "lib",
24
- "lib",
25
- "webpack.config.js",
26
- "rollup.config.mjs"
27
- ]
28
- }
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "lib",
5
+ "rootDir": "./src",
6
+ "sourceMap": true,
7
+ "noImplicitAny": true,
8
+ "declaration": true,
9
+ "lib": ["es6", "dom", "esnext", "es2015.core"],
10
+ "allowSyntheticDefaultImports": true,
11
+ "esModuleInterop": true,
12
+ "jsx": "react"
13
+ },
14
+ "include": ["src"],
15
+ "exclude": ["node_modules", "lib"]
16
+ }
@@ -1,29 +1,34 @@
1
- import { createRollupConfig } from '../../../rollup.config.base.mjs';
1
+ import { createRollupConfig } from '<%= offsetFromRoot %>rollup.config.base.mjs';
2
2
 
3
3
  // Define any additional plugins specific to this bundle
4
- const additionalPlugins = [
5
- ];
4
+ const additionalPlugins = [];
6
5
 
7
6
  // Use the createRollupConfig function to merge the base and specific configurations
8
- export default [
9
- createRollupConfig({
10
- input: ['src/index.ts'],
11
- plugins: [
12
- // Spread in additional plugins specific to this config
13
- ...additionalPlugins,
14
- ],
15
- output: [
16
- {
17
- dir: 'lib',
18
- format: 'es',
19
- name: 'Client',
20
- compact: true,
21
- exports: 'named',
22
- sourcemap: true,
23
- preserveModules: true,
24
- chunkFileNames: '[name]-[hash].[format].js',
25
- globals: { react: 'React' },
26
- },
27
- ],
28
- }),
29
- ];
7
+ export default (commandLineArgs) => {
8
+ const isWatchMode = commandLineArgs.watch;
9
+ return [
10
+ createRollupConfig({
11
+ input: ['src/index.ts'],
12
+ plugins: [
13
+ // Spread in additional plugins specific to this config
14
+ ...additionalPlugins,
15
+ ],
16
+ output: [
17
+ {
18
+ dir: 'lib',
19
+ format: 'es',
20
+ name: 'Accounts',
21
+ compact: true,
22
+ exports: 'named',
23
+ sourcemap: true,
24
+ preserveModules: true,
25
+ chunkFileNames: '[name]-[hash].[format].js',
26
+ globals: { react: 'React' },
27
+ },
28
+ ],
29
+ }, {
30
+ isWatchMode,
31
+ generateRoutesJSON: false,
32
+ }),
33
+ ];
34
+ };
@@ -1,27 +1,14 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "jsx": "react",
5
- "rootDir": "src",
6
- "outDir": "lib",
7
- "declaration": true,
8
- "declarationDir": "lib",
9
- "types": [
10
- "@types/node",
11
- "@types/jest",
12
- "../../../typings",
13
- ],
14
- "skipLibCheck": true
15
- },
16
- "include": [
17
- "src"
18
- ],
19
- "exclude": [
20
- "../../../node_modules",
21
- "node_modules",
22
- "lib",
23
- "lib",
24
- "webpack.config.js",
25
- "rollup.config.mjs"
26
- ]
27
- }
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "jsx": "react",
5
+ "rootDir": "src",
6
+ "outDir": "lib",
7
+ "declaration": true,
8
+ "declarationDir": "lib",
9
+ "types": ["@types/node", "@types/jest", "../../../typings"],
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src"],
13
+ "exclude": ["../../../node_modules", "node_modules", "lib", "webpack.config.js", "rollup.config.mjs"]
14
+ }
@@ -1,65 +1,37 @@
1
- import graphql from '@rollup/plugin-graphql';
2
- import image from '@rollup/plugin-image';
3
- import typescript from '@rollup/plugin-typescript';
4
- import { string } from 'rollup-plugin-string';
5
- function appendJsExtensionForMonacoEditor() {
6
- return {
7
- name: 'append-js-extension-for-monaco-editor',
8
- transform(code, id) {
9
- // Only modify .ts files and ignore node_modules
10
- if (id.includes('node_modules') || !id.endsWith('.ts')) {
11
- return null;
12
- }
1
+ import { createRollupConfig } from '<%= offsetFromRoot %>rollup.config.base.mjs';
13
2
 
14
- let modifiedCode = code;
15
- const monacoImportRegex = /(@vscode-alt\/monaco-editor\/esm\/vs\/[a-zA-Z0-9\/._-]+)(?<!\.js)('|")/g;
3
+ // Define any additional plugins specific to this bundle
4
+ const additionalPlugins = [];
16
5
 
17
- modifiedCode = modifiedCode.replace(monacoImportRegex, (match, p1, p2) => {
18
- // Directly append '.js' to the captured path, excluding if it already ends with '.js'
19
- return `${p1}.js${p2}`;
20
- });
21
-
22
- return {
23
- code: modifiedCode,
24
- map: null, // Returning null for simplicity, consider generating source maps if necessary
25
- };
26
- },
27
- };
28
- }
29
-
30
- const bundle = (config) => ({
31
- ...config,
32
- input: 'src/index.ts',
33
- // marking all node modules as external
34
- external: (id) => !/^[./]/.test(id),
35
- });
36
- const globals = { react: 'React' };
37
-
38
- export default [
39
- bundle({
40
- plugins: [
41
- typescript({ noEmitOnError: true }),
42
- image(),
43
- graphql({
44
- include: '**/*.gql',
45
- }),
46
- string({
47
- include: '**/*.graphql',
48
- }),
49
- appendJsExtensionForMonacoEditor(),
50
- ],
51
- output: [
6
+ // Use the createRollupConfig function to merge the base and specific configurations
7
+ export default (commandLineArgs) => {
8
+ const isWatchMode = commandLineArgs.watch;
9
+ return [
10
+ createRollupConfig(
11
+ {
12
+ input: ['src/index.ts'],
13
+ plugins: [
14
+ // Spread in additional plugins specific to this config
15
+ ...additionalPlugins,
16
+ ],
17
+ output: [
18
+ {
19
+ dir: 'lib',
20
+ format: 'es',
21
+ name: 'Accounts',
22
+ compact: true,
23
+ exports: 'named',
24
+ sourcemap: true,
25
+ preserveModules: true,
26
+ chunkFileNames: '[name]-[hash].[format].js',
27
+ globals: { react: 'React' },
28
+ },
29
+ ],
30
+ },
52
31
  {
53
- dir: 'lib',
54
- format: 'es',
55
- name: 'Core',
56
- compact: true,
57
- exports: 'named',
58
- sourcemap: false,
59
- preserveModules: true,
60
- chunkFileNames: '[name]-[hash].[format].js',
61
- globals,
32
+ isWatchMode,
33
+ generateRoutesJSON: false,
62
34
  },
63
- ],
64
- }),
65
- ];
35
+ ),
36
+ ];
37
+ };
@@ -1,22 +1,13 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "resolveJsonModule": true,
5
- "rootDir": "src",
6
- "outDir": "lib",
7
- "declaration": true,
8
- "preserveConstEnums": true,
9
- "declarationDir": "lib"
10
- },
11
- "include": [
12
- "src"
13
- ],
14
- "exclude": [
15
- "../../../node_modules",
16
- "node_modules",
17
- "lib",
18
- "lib",
19
- "webpack.config.js",
20
- "rollup.config.mjs"
21
- ]
22
- }
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "resolveJsonModule": true,
5
+ "rootDir": "src",
6
+ "outDir": "lib",
7
+ "declaration": true,
8
+ "preserveConstEnums": true,
9
+ "declarationDir": "lib"
10
+ },
11
+ "include": ["src"],
12
+ "exclude": ["../../../node_modules", "node_modules", "lib", "webpack.config.js", "rollup.config.mjs"]
13
+ }
@@ -1,30 +1,37 @@
1
- import { createRollupConfig } from '../../../rollup.config.base.mjs';
2
- import json from '@rollup/plugin-json'
1
+ import { createRollupConfig } from '<%= offsetFromRoot %>rollup.config.base.mjs';
2
+ import json from '@rollup/plugin-json';
3
3
 
4
4
  // Define any additional plugins specific to this bundle
5
- const additionalPlugins = [
6
- json()
7
- ];
5
+ const additionalPlugins = [json()];
8
6
 
9
7
  // Use the createRollupConfig function to merge the base and specific configurations
10
- export default [
11
- createRollupConfig({
12
- input: ['src/index.ts'],
13
- plugins: [
14
- // Spread in additional plugins specific to this config
15
- ...additionalPlugins,
16
- ],
17
- output: [
8
+ export default (commandLineArgs) => {
9
+ const isWatchMode = commandLineArgs.watch;
10
+ return [
11
+ createRollupConfig(
18
12
  {
19
- dir: 'lib',
20
- format: 'es',
21
- name: 'Server',
22
- compact: true,
23
- exports: 'named',
24
- sourcemap: true,
25
- preserveModules: true,
26
- chunkFileNames: '[name]-[hash].[format].js',
13
+ input: ['src/index.ts'],
14
+ plugins: [
15
+ // Spread in additional plugins specific to this config
16
+ ...additionalPlugins,
17
+ ],
18
+ output: [
19
+ {
20
+ dir: 'lib',
21
+ format: 'es',
22
+ name: 'Accounts',
23
+ compact: true,
24
+ exports: 'named',
25
+ sourcemap: true,
26
+ preserveModules: true,
27
+ chunkFileNames: '[name]-[hash].[format].js',
28
+ },
29
+ ],
27
30
  },
28
- ],
29
- }),
30
- ];
31
+ {
32
+ isWatchMode,
33
+ generateRoutesJSON: false,
34
+ },
35
+ ),
36
+ ];
37
+ };
@@ -1,27 +1,17 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "resolveJsonModule": true,
5
- "rootDir": "./src",
6
- "outDir": "lib",
7
- "sourceMap": false,
8
- "noEmitOnError": false,
9
- "declarationDir": "lib",
10
- "skipLibCheck": true,
11
- "declaration": true,
12
- "declarationMap": true,
13
- "types": [
14
- "@types/node",
15
- "@types/jest",
16
- "../../../typings"
17
- ]
18
- },
19
- "include": ["src"],
20
- "exclude": [
21
- "node_modules",
22
- "lib",
23
- "dist",
24
- "rollup.config.mjs",
25
- "webpack.config.js"
26
- ]
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "resolveJsonModule": true,
5
+ "rootDir": "./src",
6
+ "outDir": "lib",
7
+ "sourceMap": false,
8
+ "noEmitOnError": false,
9
+ "declarationDir": "lib",
10
+ "skipLibCheck": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "types": ["@types/node", "@types/jest", "../../../typings"]
14
+ },
15
+ "include": ["src"],
16
+ "exclude": ["node_modules", "lib", "dist", "rollup.config.mjs", "webpack.config.js"]
27
17
  }
@@ -1,9 +1,11 @@
1
- import { addProjectConfiguration, formatFiles, generateFiles, Tree, updateJson } from '@nx/devkit';
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import { formatFiles, generateFiles, Tree, updateJson, offsetFromRoot } from '@nx/devkit';
2
3
  import * as path from 'path';
3
4
  import { AddPackageGeneratorSchema } from './schema';
4
5
  import { isValid, getValid } from '../../utils';
5
6
  import { processFiles } from '../../utils/filesConfig';
6
7
  import { syncConfig } from '../../utils/syncConfig';
8
+ import { renameDotFiles, copyNpmrc } from '../../utils/copyDotfiles';
7
9
 
8
10
  export async function addPackageGenerator(tree: Tree, options: AddPackageGeneratorSchema) {
9
11
  if (!isValid(options.name)) {
@@ -14,14 +16,14 @@ export async function addPackageGenerator(tree: Tree, options: AddPackageGenerat
14
16
  const packages = ['core', 'client', 'browser', 'server'];
15
17
  const packageType = getValid(options.packageType);
16
18
  if (packageType && packageType.toLocaleLowerCase() !== 'all') {
17
- if(!packages.includes(packageType)) {
19
+ if (!packages.includes(packageType)) {
18
20
  console.error('Package type is not available! please choice in Client|Browser|Core|Server|All');
19
21
  return;
20
22
  }
21
- generatePackage(tree, {...options, type: packageType.toLocaleLowerCase()}, true);
23
+ generatePackage(tree, { ...options, type: packageType.toLocaleLowerCase() }, true);
22
24
  } else {
23
- packages.forEach(pkg => {
24
- const configs: any = {...options, type: pkg};
25
+ packages.forEach((pkg) => {
26
+ const configs: any = { ...options, type: pkg };
25
27
  generatePackage(tree, configs, true);
26
28
  });
27
29
  }
@@ -35,28 +37,84 @@ export async function addPackageGenerator(tree: Tree, options: AddPackageGenerat
35
37
  // configs.type = packageName;
36
38
  // generatePackage(tree, configs, false);
37
39
  // }
38
-
40
+
39
41
  // await formatFiles(tree);
40
42
  // }
41
43
 
42
44
  export const generatePackage = async (tree: Tree, options: any, cmdLine: boolean = false) => {
43
- const basePath = `${options.name}/${options.type}`;
44
- const packageRoot = isValid(options.directory) ? `${getValid(options.directory)}/${basePath}` : basePath;
45
- const baseName = isValid(options.name) ? `${options.name}-${options.type}` : options.type;
46
- const packageName = isValid(options.ns) ? `${getValid(options.ns)}-${baseName}` : baseName;
47
-
48
- generateFiles(tree, path.join(__dirname, 'files', options.type), packageRoot, options);
49
- updateJson(tree, `${packageRoot}/package.json`, (packageJson) => {
50
- packageJson['name'] = packageName;
45
+ const packageName = getValid(options.name) ?? 'empty-package';
46
+ let projectRoot = '';
47
+
48
+ if (isValid(options.directory)) {
49
+ projectRoot = `${getValid(options.directory)}/${packageName}`;
50
+ } else {
51
+ projectRoot = `packages/${packageName}`;
52
+ }
53
+
54
+ // Namespace the package if provided
55
+ let fullPackageName = packageName;
56
+ if (isValid(options.ns)) {
57
+ fullPackageName = `${getValid(options.ns)}-${packageName}`;
58
+ }
59
+
60
+ // Calculate the offset from root for relative paths in templates
61
+ const offset = offsetFromRoot(projectRoot);
62
+
63
+ // Define template options with offsetFromRoot for relative paths
64
+ const templateOptions = {
65
+ ...options,
66
+ name: fullPackageName,
67
+ offsetFromRoot: offset,
68
+ template: '',
69
+ dot: '.',
70
+ };
71
+
72
+ // Determine the package type and generate files accordingly
73
+ const packageType = getValid(options.type) ?? 'core';
74
+
75
+ console.log(`Generating ${packageType} package: ${fullPackageName} at ${projectRoot}`);
76
+
77
+ // Generate the appropriate package files based on type
78
+ switch (packageType) {
79
+ case 'browser':
80
+ generateFiles(tree, path.join(__dirname, 'files', 'browser'), projectRoot, templateOptions);
81
+ break;
82
+ case 'client':
83
+ generateFiles(tree, path.join(__dirname, 'files', 'client'), projectRoot, templateOptions);
84
+ break;
85
+ case 'server':
86
+ generateFiles(tree, path.join(__dirname, 'files', 'server'), projectRoot, templateOptions);
87
+ break;
88
+ case 'core':
89
+ default:
90
+ generateFiles(tree, path.join(__dirname, 'files', 'core'), projectRoot, templateOptions);
91
+ break;
92
+ }
93
+
94
+ // Rename underscore-prefixed files to dot files
95
+ renameDotFiles(tree, projectRoot);
96
+
97
+ // Copy .npmrc from the main project root if exists
98
+ const mainProjectRoot = options.projectRoot || '';
99
+ copyNpmrc(tree, mainProjectRoot, projectRoot);
100
+
101
+ // Update package.json with the correct package name
102
+ updateJson(tree, `${projectRoot}/package.json`, (packageJson) => {
103
+ packageJson.name = fullPackageName;
51
104
  return packageJson;
52
105
  });
53
106
 
54
107
  if (cmdLine) {
55
- syncConfig(tree, packageRoot, options);
108
+ syncConfig(tree, projectRoot, options);
56
109
  } else {
57
- processFiles(tree, packageRoot, options);
110
+ processFiles(tree, projectRoot, options);
58
111
  await formatFiles(tree);
59
112
  }
60
- }
113
+
114
+ return {
115
+ packageName: fullPackageName,
116
+ projectRoot,
117
+ };
118
+ };
61
119
 
62
120
  export default addPackageGenerator;
@@ -1,71 +0,0 @@
1
- var nodeExternals = require('webpack-node-externals');
2
- var webpack = require('webpack');
3
- var path = require('path');
4
-
5
- var webpack_opts = {
6
- mode: 'development',
7
- entry: './src/index.tsx',
8
- target: 'node',
9
- output: {
10
- path: path.join(__dirname, 'lib'),
11
- filename: 'index.js',
12
- libraryTarget: "commonjs2",
13
- },
14
- node: {
15
- __dirname: false
16
- },
17
- resolve: {
18
- extensions: ['.ts', '.tsx', '.graphql', '.gql'],
19
- },
20
- plugins: [
21
- new webpack.LoaderOptionsPlugin({
22
- options: {
23
- test: /\.tsx?$/,
24
- ts: {
25
- compiler: 'typescript',
26
- configFile: 'tsconfig.json'
27
- },
28
- tslint: {
29
- emitErrors: true,
30
- failOnHint: true
31
- }
32
- }
33
- })
34
- ],
35
- devtool: 'source-map',
36
- module: {
37
- rules: [{
38
- test: /\.tsx?$/,
39
- use: 'ts-loader'
40
- },
41
- {
42
- test: /\.(pdf|jpg|png|gif|svg|ico)$/,
43
- use: [
44
- {
45
- loader: "url-loader"
46
- }
47
- ]
48
- },
49
- {
50
- test: /\.mjs$/,
51
- include: /node_modules/,
52
- type: 'javascript/auto',
53
- },
54
- {
55
- test: /\.graphql?/,
56
- exclude: /node_modules/,
57
- use: 'raw-loader',
58
- }, {
59
- test: /\.(gql)$/,
60
- exclude: /node_modules/,
61
- use: ['graphql-tag/loader']
62
- }
63
- ]
64
- },
65
- externals: [
66
- nodeExternals({ modulesDir: "../../../node_modules" }),
67
- nodeExternals()
68
- ]
69
- };
70
-
71
- module.exports = webpack_opts;
@@ -1,72 +0,0 @@
1
- var nodeExternals = require('webpack-node-externals');
2
- var webpack = require('webpack');
3
- var path = require('path');
4
- var fs = require('fs');
5
-
6
- var webpack_opts = {
7
- mode: 'development',
8
- entry: './src/index.ts',
9
- target: 'node',
10
- output: {
11
- path: path.join(__dirname, 'lib'),
12
- filename: 'index.js',
13
- libraryTarget: "commonjs2",
14
- },
15
- node: {
16
- __dirname: false
17
- },
18
- resolve: {
19
- extensions: ['.ts', '.tsx', '.graphql', '.gql'],
20
- },
21
- plugins: [
22
- new webpack.LoaderOptionsPlugin({
23
- options: {
24
- test: /\.tsx?$/,
25
- ts: {
26
- compiler: 'typescript',
27
- configFile: 'tsconfig.json'
28
- },
29
- tslint: {
30
- emitErrors: true,
31
- failOnHint: true
32
- }
33
- }
34
- })
35
- ],
36
- devtool: 'source-map',
37
- module: {
38
- rules: [{
39
- test: /\.tsx?$/,
40
- use: 'ts-loader'
41
- },
42
- {
43
- test: /\.mjs$/,
44
- include: /node_modules/,
45
- type: 'javascript/auto',
46
- },
47
- {
48
- test: /\.graphql?/,
49
- exclude: /node_modules/,
50
- use: 'raw-loader',
51
- }, {
52
- test: /\.(gql)$/,
53
- exclude: /node_modules/,
54
- use: ['graphql-tag/loader']
55
- },
56
- {
57
- test: /\.(pdf|jpg|png|gif|svg|ico)$/,
58
- use: [
59
- {
60
- loader: "url-loader"
61
- }
62
- ]
63
- },
64
- ]
65
- },
66
- externals: [
67
- nodeExternals({ modulesDir: "../../../node_modules" }),
68
- nodeExternals()
69
- ]
70
- };
71
-
72
- module.exports = webpack_opts;