tinkoff / tramvai Goto Github PK
View Code? Open in Web Editor NEWA modular framework for universal JS applications
Home Page: https://tramvai.dev/
License: Apache License 2.0
A modular framework for universal JS applications
Home Page: https://tramvai.dev/
License: Apache License 2.0
Why are you still using @babel/polyfill in 2021 ?
https://github.com/TinkoffCreditSystems/tramvai/blob/main/packages/cli/package.json#L47
It's deprecated package by Babel team
https://www.npmjs.com/package/@babel/polyfill
After empty & fresh project launch, I've got this error:
{"statusCode":500,"code":"ECONNREFUSED","error":"Internal Server Error","message":"request to http://localhost:4000/dist/client/stats.modern.json failed, reason: connect ECONNREFUSED ::1:4000"}
Node.js version: 18.3.0
Tramvai version: 1.110.2
Reproduce step:
1. npx @tramvai/create new-app
2. cd new-app && yarn start
Hello from Aviasales :)
We are trying to use webpack-dedupe-plugin for local development, especially with yarn link. As I can see right now it works only in production mode because normalModuleFactory called only once https://github.com/Tinkoff/tramvai/blob/main/packages/libs/webpack-dedupe-plugin/src/DedupePlugin.ts#L201-L204
We tried to adopt it for watch mode with mini-css-extract-plugin. It doesn't use a child compiler anymore, but we faced a bug: currently within the cache key could be stored different modules with different loaders.
[
"@csstools/[email protected]:./normalize.css",
[
"/Users/v7rulnik/projects/aviasales/selene/node_modules/mini-css-extract-plugin/dist/loader.js!/Users/v7rulnik/projects/aviasales/selene/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].use[1]!/Users/v7rulnik/projects/aviasales/selene/node_modules/@csstools/normalize.css/normalize.css",
"/Users/v7rulnik/projects/aviasales/selene/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].use[1]!/Users/v7rulnik/projects/aviasales/selene/node_modules/@csstools/normalize.css/normalize.css"
]
]
So we added loaders to cache keys:
diff --git a/lib/DedupePlugin.js b/lib/DedupePlugin.js
index 46fefe8e75b7435c0165d3cdbe622253aebdb122..3cd56486a83f3d3e3ea930b89462e7d8c5a12114 100644
--- a/lib/DedupePlugin.js
+++ b/lib/DedupePlugin.js
@@ -128,14 +128,7 @@ class DedupePlugin {
}
}
apply(compiler) {
- let called = false;
- // этот хук будет вызываться при каждом создании компилятора, но это создает дубли модулей,
- // с которыми пока непонятно что делать, поэтому просто игнорируем childCompiler
compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => {
- if (called) {
- return;
- }
- called = true;
nmf.hooks.module.tap(PLUGIN_NAME, (module, result) => {
// игнорируем все что вне node_modules, т.к. вряд-ли это нужно дедуплицировать или если модуль игнорируем
if (!module.resource.includes('node_modules') || this.isIgnoredModule(result)) {
@@ -225,8 +218,10 @@ function createCacheKeyFromNMFResult(nmfResult, useSemver = false) {
// если semver то используем только мажорную версию пакета
// если нет, то оставляем полную версию
const versionForCache = useSemver ? buildCacheVersionFromNMFResult(nmfResult) : version;
+ const loaders = nmfResult.loaders.map(item => item.loader).join('|');
// ключ = имя + версия + путь к исходному файлу относительно корня либы
- return `${name}@${versionForCache}:${nmfResult.resourceResolveData.relativePath}`;
+ return `${name}@${versionForCache}:${nmfResult.resourceResolveData.relativePath}:${loaders}`;
}
/**
* Получаем основную версию для зависимости по правилу semver `^version`
I understand that you have your own stack and needs so basically I created this issue to give some feedback. But maybe you see how we can support our (and I believe many people too) use case?
Mistype at main project page - tramvai.dev
const incrementAction = createEvent('increment');
const countReducer = createReducer('count', 0) .on(increment, (state) => state + 1);
const Component = () => { const count = useSelector('count', (state) => state);
const increment = useActions(incrementAction);
.on(increment, -> .on(incrementAction ,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.