Storybook: مشاكل مع المسارات المطلقة

تم إنشاؤها على ٢٥ يوليو ٢٠١٦  ·  3تعليقات  ·  مصدر: storybookjs/storybook

هذا يعمل

import Component from '../component.jsx';

يلقي خطأ

import Component from '/client/modules/account_details/components/component.jsx';

Module not found: Error: Cannot resolve 'file' or 'directory'

تحتوي بعض مكوناتي على مسارات مطلقة في بيان الاستيراد ، وهذا يكسر القصة أيضًا. هل هناك حل آخر بخلاف تنفيذ ../../../../ وما إلى ذلك؟

حاولت استخدام https://github.com/mantrajs/babel-root-slash-import لكنني بدأت في الحصول على
Uncaught SyntaxError: Unexpected token import بعد إضافة تلك الحزمة و .babelrc ملف مع

{
  "plugins": [
    "babel-root-slash-import"
  ]
}

ال 3 كومينتر

كان قادرًا على حل هذه المشكلة مع

{
  "presets": ["es2015", "react"],
  "plugins": [
    "babel-root-slash-import"
  ]
}
{
    "presets": ["es2015", "react"],
    "plugins": [
        [
            "babel-root-slash-import", {
                "rootPathSuffix": "src/"
            }
        ]
    ]
  }

شيء من هذا القبيل؟
لأن هذا لا يعمل

هذا أيضًا يتجاوز التكوين الافتراضي لـ .babelrc من إنشاء تطبيق رد فعل؟

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات