canopy-webpack-config 4.0.0 → 4.1.0

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.
package/.yarnrc.yml ADDED
@@ -0,0 +1,2 @@
1
+ yarnPath: .yarn/releases/yarn-3.6.2.cjs
2
+ nodeLinker: node-modules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canopy-webpack-config",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Some defaults for webpack configs at canopy",
5
5
  "main": "src/canopy-webpack-config.js",
6
6
  "repository": "git@github.com:CanopyTax/canopy-webpack-config.git",
@@ -18,5 +18,6 @@
18
18
  "url": "^0.11.0",
19
19
  "webpack-bundle-analyzer": "^4.7.0",
20
20
  "webpack-merge": "^4.2.1"
21
- }
21
+ },
22
+ "packageManager": "yarn@3.6.2"
22
23
  }
@@ -24,7 +24,7 @@ const port =
24
24
  ? process.argv[portIndex + 1]
25
25
  : "8080";
26
26
 
27
- module.exports = function (name, overridesConfig) {
27
+ module.exports = function (name, overridesConfig = {}, typescript) {
28
28
  if (typeof name !== "string") {
29
29
  throw new Error(
30
30
  "canopy-webpack-config expects a string name as the first argument"
@@ -47,7 +47,7 @@ module.exports = function (name, overridesConfig) {
47
47
  }
48
48
 
49
49
  const defaultCanopyConfig = {
50
- entry: `./src/${name}.js`,
50
+ entry: `./src/${name}.${typescript ? "ts" : "js"}`,
51
51
  output: {
52
52
  filename: `${name}.js`,
53
53
  publicPath: "",
@@ -63,7 +63,7 @@ module.exports = function (name, overridesConfig) {
63
63
  module: {
64
64
  rules: [
65
65
  {
66
- test: /\.m?js$/,
66
+ test: typescript ? /\.(tsx|ts|m?js)?$/ : /\.m?js$/,
67
67
  exclude: [path.resolve(process.cwd(), "node_modules")],
68
68
  loader: "babel-loader",
69
69
  options: {
@@ -76,6 +76,11 @@ module.exports = function (name, overridesConfig) {
76
76
  ],
77
77
  },
78
78
  resolve: {
79
+ ...(typescript
80
+ ? {
81
+ extensions: [".tsx", ".ts", ".js", ".mjs"],
82
+ }
83
+ : {}),
79
84
  modules: [process.cwd(), "node_modules"],
80
85
  fallback: {
81
86
  url: require.resolve("url/"),