Загрузчик машинного перевода babel [awesome] не может выдать ошибку в упакованном типе lerna

У меня есть упакованное приложение lerna с машинописью, упакованное с помощью babel и awesome-typescript-loader (хотя я также пробовал typcript-loader).

Когда веб-приложение, я получаю следующую ошибку.

File '/.../packages/submodule1/lib/types.ts' is not under 'rootDir' '~/.../packages/submodule2/'. 'rootDir' is expected to contain all source files.

мой цонфиг это

{
  "compilerOptions": {
    /* Basic Options */
    "declaration": true,
    "target": "es6",                       
    "allowJs": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": false,
    "moduleResolution": "node",
    "module": "commonjs",
    "outDir": ".build",
    "rootDir": "./",
    "jsx": "react",
    "lib": [
      "es5",
      "es6",
      "es7",
      "dom",
      "es2015.core",
      "es2015.collection",
      "es2015.generator",
      "es2015.iterable",
      "es2015.promise",
      "es2015.proxy",
      "es2015.reflect",
      "es2015.symbol",
      "es2015.symbol.wellknown",
      "esnext",
      "esnext.asynciterable"
    ],
    "types": ["node"],

    "strict": true,                 

    "allowSyntheticDefaultImports": true  
  },
  "include": ["./src/**.*"]
}

В моем веб-пакете я пробовал исключать submodule1, но странно, что это не решает проблему

module.exports = {
    entry: {
      home:  "./src/pages/home/homeBundle",
      upload:  "./src/pages/upload/uploadBundle",
      studio: "./src/pages/studio/studioBundle",
      workers: "./src/components/viewer/workers"
    },
    output: {
        filename: '[name]Bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    devServer: {
        port: 3000
    },
    node: {
        fs: 'empty'
    },
    // Enable sourcemaps for debugging webpack's output.
    devtool: "source-map",

    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".ts", ".tsx", ".js", ".json"],
        alias: {
            react: path.resolve(__dirname,"./node_modules/react"),
            "react-dom": path.resolve(__dirname,"./node_modules/react-dom"),
            "react-animate-on-change": path.resolve(__dirname,"./node_modules/react-animate-on-change")
        }
    },

    module: {
        loaders: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            {test: /\.tsx?$/,
                loader: 'awesome-typescript-loader',
                exclude: /submodule1/
            },
            {
                test: /\.jsx?$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.css$/,
                use: ExtractTextPlugin.extract({
                    fallback:'style-loader',
                    use: 'css-loader?modules&localIdentName=[name]__[local]' //___[hash:base64:5]'
                })
            },
            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            { test: /\.js$/, loader: "source-map-loader" }
        ]
    },
    plugins: [
        new ExtractTextPlugin('[name].css', { allChunks: true }),
        new webpack.DefinePlugin({
            'process.env': {
              'AYVRI_API': JSON.stringify(process.env.AYVRI_API),
              'assetPath': '"http://localhost:3000/assets"'
            }
          })
    ]
};

Я считаю, что проблема в том, что lerna создает символические ссылки на локальные модули, но я не уверен.

Я должен также упомянуть, я импортирую типы из JSON-схемы в module1 и экспортировать его в остальные module2 как это

import * as vera from 'module1/lib/types';
export * from 'module1/lib/types';

0 ответов

Другие вопросы по тегам