-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add packages with prefix vsf- to webpack process #2271
Comments
@filrak i'm quiet busy with this, but can't make any progress. What i did so far: I added my test npm package path to the babel loader rule include property. changed the ts-loader rule to: Added the option In ==================== This way the compiling in the console went sucessfully. But when you call the vsf instance in browser, you see that the npm package seems not to be processed through babel (f.e. console fills with not tranformed imports from my test npm package) I'm really stuck with this and as you mentioned before that it would be an easy implementation i feel like i'm overdoing something right now. I can really use some help with this one from someone with more webpack config experience. |
Hey! Please play with include property of webpack loaders for babel-lowder. You're close to the end I guess and the thing that is lacking is this property |
hi @filrak :) |
I'd like to request support for scoped packages as well i.e. |
Any package in `node_modules` starting with vsf-* or @<scope>/vsf- will be processed by webpack Fixes vuestorefront#2271, vuestorefront#2395.
@zimme great job. If i add your changes to Module build failed (from ./node_modules/ts-loader/index.js): Also, when you visit the VSF instance, you get 'SyntaxError: Unexpected token import'. This error comes from: 'node_modules/ts-node/src/index.ts:431:14' When Googling this issue it seems that we need some changes to tsconfig.json, but to be honoust i did not find the solution so far. Any help is welcome |
I also ran into this problem when testing today. As you say, I believe tsconfig might need updating as it excludes node_modules. |
@DaanKouters Could you try with the changes added in this commit and see if it works? |
hi @zimme i tested it with your changes, at first i still got the compile error, but i noticed you left "node_modules" in the exclude property.
But when i go to the storefront in browser, the console throws multiple errors on 'vuestorefront/node_modules/ts-node/src/index.ts:431:14'. This message led me to this issue on the ts-node github: I don't have a solution for this. Maybe valuable to know i added a NPM package to my test project this way: |
@DaanKouters Try leaving and add these changes to
ps. You're adding the package in the way I expect it to be added so that's fine. |
@zimme ok, when i leave the exclude as it was (with "node_modules") i get in compilation: And adding the vsf paths to the exclude in tsconfig-build didn't make a noticable change, still the ts-node error 'node_modules/ts-node/src/index.ts:431:14' |
I saw that the regex to exclude everything except vsf- packages were wrong and I looked into ts-node and realized it didn't use the include/exclude from tsconfig so I'm testing setting an environment variable to ignore all but vsf- packages in node_modules which ignores the whole folder by default |
Ok, so I've been trying out different things here and I've been able to overcome the I've added I've tried with It seems that all build tools around typescript have a default to ignore anything So unless someone smarter than me can figure this one out I believe we should revert #2875 and ask module developers to build their typescript code before publishing their packages. What could be done to ease that is to provide the build script needed via the vue-storefront-cli tool so that module developer don't have to configure their own build pipeline but just npm install the cli and add it to the script section of their package.json file. /cc @filrak @DaanKouters |
This issue should be re-opened. |
hi @zimme firstly, thanks for your efforts This is going a bit above my hat right now, so if i can help with testing or something please let me know |
@zimme How did you manage to overcome the |
@jahvi The changes in the last 3 commits here is what I did. I also don't remember if I had the npm package with the vsf module as a dependency in vue-storefront or in the theme I'm not sure that the |
I haven't had any luck with this unfortunately, I also wonder if the best approach here would be to make it easier for 3rd parties to compile their TS code before publishing modules/extensions, maybe by providing a boilerplate or step by step instructions. Maybe someone with more experience with TS could help. |
@patzick Did you solve the problem we ran into here before adding back the commit? |
@zimme sorry this was caused by merge into master. I'm reopening it. |
This issue has been closed due to inactivity. If you want to re-open the issue, please re-create the issue, and post newer information on this problem. |
What is the motivation for adding / enhancing this feature?
Currently none of the third party libs are processed through loaders in our webpack process. While it's ok for most of them it's not ok for 3rd party VS modules. They should he included into our webpack process.
This requires changing regular expressions for loader in
core/build
folder.What are the acceptance criteria
node_modules
with name starting fromvsf-
should be included into our webpack process for all loaders (as it would be in in thecore
)Can you complete this feature request by yourself?
NO
Additional information
Feel free to ask for details on slack
The text was updated successfully, but these errors were encountered: