@razerspine/webpack-core 1.0.6 → 1.0.7

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.
@@ -89,5 +89,12 @@ export declare function createBaseConfig(options: ConfigOptionType): {
89
89
  plugins: any[];
90
90
  resolve: {
91
91
  extensions: string[];
92
+ alias: {
93
+ alias: string | false | string[];
94
+ name: string;
95
+ onlyModule?: boolean;
96
+ }[] | {
97
+ [index: string]: string | false | string[];
98
+ };
92
99
  };
93
100
  };
@@ -6,7 +6,7 @@ const scripts_1 = require("../loaders/scripts");
6
6
  const styles_1 = require("../loaders/styles");
7
7
  const templates_1 = require("../loaders/templates");
8
8
  function createBaseConfig(options) {
9
- var _a, _b;
9
+ var _a, _b, _c, _d, _e, _f;
10
10
  const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : 'development';
11
11
  return {
12
12
  mode,
@@ -30,10 +30,12 @@ function createBaseConfig(options) {
30
30
  ...(0, templates_1.templatesLoader)({
31
31
  entry: (_b = options.templates) === null || _b === void 0 ? void 0 : _b.entry,
32
32
  mode,
33
+ aliases: (_d = (_c = options.resolve) === null || _c === void 0 ? void 0 : _c.alias) !== null && _d !== void 0 ? _d : {},
33
34
  }),
34
35
  ],
35
36
  resolve: {
36
37
  extensions: ['.ts', '.tsx', '.js', '.json'],
38
+ alias: (_f = (_e = options.resolve) === null || _e === void 0 ? void 0 : _e.alias) !== null && _f !== void 0 ? _f : {}
37
39
  },
38
40
  };
39
41
  }
@@ -1,4 +1,5 @@
1
1
  export declare function templatesLoader(options: {
2
2
  entry?: string;
3
3
  mode: 'development' | 'production';
4
+ aliases?: Record<string, string> | {};
4
5
  }): any[];
@@ -10,7 +10,6 @@ function templatesLoader(options) {
10
10
  return [
11
11
  new pug_plugin_1.default({
12
12
  entry: (_a = options.entry) !== null && _a !== void 0 ? _a : 'src/views/pages',
13
- baseDir: process.cwd(),
14
13
  filename: ({ chunk }) => {
15
14
  let [name] = chunk.name.split('/');
16
15
  if (name === 'home')
@@ -27,6 +26,9 @@ function templatesLoader(options) {
27
26
  ? 'css/[name].[contenthash:8].css'
28
27
  : 'css/[name].css',
29
28
  },
29
+ resolve: {
30
+ alias: options.aliases,
31
+ },
30
32
  }),
31
33
  ];
32
34
  }
@@ -1,11 +1,21 @@
1
1
  import { ModeType } from './mode-type';
2
2
  import { ScriptType } from './script-type';
3
3
  import { StyleType } from './style-type';
4
+ import { Configuration } from 'webpack';
4
5
  export type ConfigOptionType = {
5
6
  mode: ModeType;
6
7
  scripts: ScriptType;
7
8
  styles: StyleType;
8
- templates: {
9
- entry: string;
9
+ templates?: {
10
+ /**
11
+ * Path to pug pages directory
12
+ * @default 'src/views/pages'
13
+ */
14
+ entry?: string;
10
15
  };
16
+ /**
17
+ * Webpack resolve config (aliases, extensions, etc.)
18
+ * Passed through to final webpack config
19
+ */
20
+ resolve?: Configuration['resolve'];
11
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razerspine/webpack-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Core webpack config and loaders for starter templates",
5
5
  "license": "ISC",
6
6
  "author": "Razerspine",