[Ellipsis] CHORE: Move all vue imports to use the extension + update vue cli to require the .vue extension in the import #2199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Issue: resolves #2195
Implementation:
Step 1: Update webpack resolve configuration in
vue.config.js
Update the webpack resolve configuration in the
vue.config.js
file in the/apps/studio/
and/apps/sqltools/
directories to include the .vue extension in all import statements. Here's an example of how to do this:This will make webpack resolve .js, .json, and .vue files, and it will fail for .vue files if the extension is not provided.
Step 2: Create a script to check import statements
Create a script using Node.js to traverse through the codebase, read each file, and check the import statements. If an import statement is found without a .vue extension, the script should throw an error. Here's a basic example of how you might structure this script:
This script starts by traversing the 'src' directory. For each file it finds, it checks if the file is a directory. If it is, it recursively traverses that directory. If it's a .js or .vue file, it reads the file and checks the import statements. If it finds an import statement without a .vue extension, it throws an error.
You can run this script as part of your build process to ensure that all import statements include the .vue extension.
Report:
Update webpack resolve configuration in
Successfully updated the webpack configuration to require the .vue extension in import statements, created a script to check all import statements in the codebase, and added a script to run this check as part of the build process.vue.config.js
Create a script to check import statements
Successfully updated the webpack configuration to require the .vue extension in import statements, created a script to check all import statements in the codebase, and added a script to run this check as part of the build process.Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #2195. Then, try again. For more information, check the documentation.