@atomicsmash/compiler 0.7.3 → 0.7.4

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 (2) hide show
  1. package/dist/index.js +33 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -89,6 +89,30 @@ const postCSSConfig = [
89
89
  ],
90
90
  ...(MODE === "production" ? [cssNano] : []),
91
91
  ];
92
+ function getEsBuildLoaderSetup(loader) {
93
+ return {
94
+ use: {
95
+ loader: "esbuild-loader",
96
+ options: {
97
+ loader: loader,
98
+ // Set target to match the browserslist config
99
+ target: browserslistToEsbuild(),
100
+ tsconfig: process.cwd() + "/tsconfig.json",
101
+ },
102
+ },
103
+ exclude: (file) => {
104
+ // Exclude all block.json.ts files (handled by a separate loader).
105
+ if (argv.experimentalBlocksSupport && file.includes("block.json")) {
106
+ return true;
107
+ }
108
+ // Exclude node_modules files from transpilation unless they are vue files and the vue-loader is present
109
+ if (vueConfig.loader.length > 0) {
110
+ return file.includes("node_modules") && !file.includes(".vue.js");
111
+ }
112
+ return file.includes("node_modules");
113
+ },
114
+ };
115
+ }
92
116
  const compiler = webpack({
93
117
  resolveLoader: {
94
118
  modules: [
@@ -150,7 +174,7 @@ const compiler = webpack({
150
174
  }),
151
175
  ],
152
176
  // resolve TS extensions
153
- extensions: [".tsx", ".ts", ".js", ".jsx"],
177
+ extensions: [".tsx", ".ts", ".js", ".jsx", ".vue"],
154
178
  },
155
179
  module: {
156
180
  rules: [
@@ -159,25 +183,14 @@ const compiler = webpack({
159
183
  // Use ESBuild loader to transpile JS & TS files
160
184
  {
161
185
  test: /\.[jt]sx?$/,
162
- use: {
163
- loader: "esbuild-loader",
164
- options: {
165
- // Set target to match the browserslist config
166
- target: browserslistToEsbuild(),
167
- tsconfig: process.cwd() + "/tsconfig.json",
168
- },
169
- },
170
- exclude: (file) => {
171
- // Exclude all block.json.ts files (handled by a separate loader).
172
- if (argv.experimentalBlocksSupport && file.includes("block.json")) {
173
- return true;
174
- }
175
- // Exclude node_modules files from transpilation unless they are vue files and the vue-loader is present
176
- if (vueConfig.loader.length > 0) {
177
- return file.includes("node_modules") && !file.includes(".vue.js");
178
- }
179
- return file.includes("node_modules");
180
- },
186
+ resourceQuery: (value) => value.includes("vue"),
187
+ // Vue files require explicitly informing ESBuild of the type of loader to use.
188
+ ...getEsBuildLoaderSetup("ts"),
189
+ },
190
+ {
191
+ test: /\.[jt]sx?$/,
192
+ resourceQuery: (value) => !value.includes("vue"),
193
+ ...getEsBuildLoaderSetup("default"),
181
194
  },
182
195
  ...(argv.experimentalBlocksSupport
183
196
  ? [
@@ -196,7 +209,6 @@ const compiler = webpack({
196
209
  // Transpile SCSS files and run the result through postcss
197
210
  {
198
211
  test: /\.s[ac]ss$/i,
199
- exclude: /node_modules/,
200
212
  type: "asset/resource",
201
213
  generator: {
202
214
  binary: false,
@@ -225,7 +237,6 @@ const compiler = webpack({
225
237
  // Run the css files through postcss
226
238
  {
227
239
  test: /\.css$/i,
228
- exclude: /node_modules/,
229
240
  type: "asset/resource",
230
241
  generator: {
231
242
  binary: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomicsmash/compiler",
3
3
  "type": "module",
4
- "version": "0.7.3",
4
+ "version": "0.7.4",
5
5
  "description": "A universal compiler for all Atomic Smash projects.",
6
6
  "keywords": [
7
7
  "cli",