Code Monkey home page Code Monkey logo

tramvai's People

Contributors

tinkoff-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tramvai's Issues

Internal error on a project startup

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

webpack-dedupe-plugin in watch mode with mini-css-extract-plugin

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 in example

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 ,

sync .eslintrc and .tsconfig.json between project types

using @tramvai/cli with option Support for multiple applications in one repository
When using that option vscode linter show errors in files, but still compiles it
2021-12-20_18-06-12

wheather this is not the case for single app per repository
2021-12-20_18-07-24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.