L
L
lex2019-01-10 19:55:57
React
lex, 2019-01-10 19:55:57

How to start supporting import?

Good evening. Help with the assembly, everything seems to be running through the file, but the type imports do not work
import { render } from './blocks/App/App';
It seems that I understand which preset or settings are missing, the paths to the components are correct (I checked several times)
here is an example of the config

webpack: {
            name: target,
            entry: join(src, target + '.tsx'),
            devtool: IS_DEVELOPMENT ? 'cheap-module-eval-source-map' : false,
            mode: NODE_ENV,
            watch: IS_DEVELOPMENT,

            output: {
                path: dist,
                filename: name,
                chunkFilename: name,
                publicPath
            },

            stats: {
                entrypoints: true
            },

            resolve: {
                modules: [
                    'node_modules',
                    'src'
                ]
            },

            module: {
                rules: [
                    {
                        test: /\.tsx|.js$/,
                        exclude: /node_modules/,
                        use: {
                            loader: 'babel-loader',
                            options: {
                                presets: [
                                    '@babel/preset-env',
                                    '@babel/preset-react'
                                ],
                                plugins: [
                                    '@babel/plugin-transform-runtime'
                                ]
                            }
                        }
                    }
                ]
            },

            plugins: [
                new webpack.DefinePlugin({
                    IS_SERVER: JSON.stringify(IS_SERVER),
                    IS_CLIENT: JSON.stringify(IS_CLIENT),
                    'typeof window': JSON.stringify(IS_CLIENT ? 'object' : 'undefined')
                }),

                new webpack.NoEmitOnErrorsPlugin(),

                ...(IS_DEVELOPMENT ? [] : [
                    new UglifyJSPlugin()
                ])
            ]
        }

The component itself is
import * as React from 'react';
import Paper from '../../common.blocks/Paper/Paper';

export default function render() {
    return <Paper>asd</Paper>
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lex, 2019-01-11
bem @bemdev

You should always accurately specify all the necessary technologies in extensions

A
Anatoly Zharov, 2019-01-10
@SeaBreeze876

import render from './blocks/App/App';
https://habr.com/post/267639/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question