Skip to content

Commit

Permalink
NEXT-29105 - allow ts files in storefront
Browse files Browse the repository at this point in the history
Added a webpack extension alias for paths that end with .js
If a file path ends with .js it will first check if there
is a typescript file otherwise it will grab the js file.
This allows us to use typescript in the storefront without
breaking plugins that use paths that end with .js
  • Loading branch information
Haberkamp authored and tobiasberge committed Jul 10, 2023
1 parent 086770f commit aed3073
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Allow typescript in the storefront
issue: NEXT-29105
---
# Storefront
* Added extension alias in webpack config for javascript files to check for typescript files first and then javascript files
3 changes: 3 additions & 0 deletions src/Storefront/Resources/app/storefront/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ let webpackConfig = {
],
resolve: {
extensions: [ '.ts', '.tsx', '.js', '.jsx', '.json', '.less', '.sass', '.scss', '.twig' ],
extensionAlias: {
'.js': ['.ts', '.js'],
},
modules: [
// statically add the storefront node_modules folder, so sw plugins can resolve it
path.resolve(__dirname, 'node_modules'),
Expand Down

0 comments on commit aed3073

Please sign in to comment.