question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't import the named export 'parse' from non EcmaScript module (only default export is available)

See original GitHub issue

Sucrase does not work with webpack

import sucrase from 'sucrase'
Webpack config
let webpack = require('webpack')

// CSS
let MiniCssExtractPlugin = require('mini-css-extract-plugin')
let autoprefixer = require('autoprefixer-stylus')

// Config
module.exports = {
	entry: './examples/app.js',
	resolve: {
		extensions: ['.js', '.styl']
	},
	module: {
		rules: [
			{
				test: /\.styl$/,
				use: [
					{
						loader: MiniCssExtractPlugin.loader,
						options: {
							hmr: true,
							reloadAll: true
						}
					},
					{
						loader: 'css-loader',
						options: {
							modules: false
						}
					},
					{
						loader: 'stylus-loader',
						options: {
							use: [autoprefixer()]
						}
					}
				],
			},
			{
				test: /\.js$/,
				exclude: /node_modules/,
				use: {
					loader: 'babel-loader',
					options: {
						presets: ['@babel/preset-env'],
						plugins: ['@babel/plugin-syntax-jsx', '@babel/plugin-transform-react-jsx']
					}
				}
			}
		],
	},
	plugins: [
		new MiniCssExtractPlugin({
			filename: '[name].css',
		}),
		new webpack.ProvidePlugin({
			ReactDOM: 'react-dom',
			React: 'react'
		})
	],
	devServer: {
		contentBase: './examples',
		historyApiFallback: true,
		inline: true,
		hot: true,
		port: 80
	}
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
DominicTobiascommented, Sep 19, 2020

I made a fork which works for CRA, Gatsby etc - yarn add sucrase-browser

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't import the named export XXXX from non EcmaScript ...
the solution is to make sure that you have a webpack.config.js file in the root of your project directory that looks something like...
Read more >
Can't import the named export from non EcmaScript module ...
mjs Can't import the named export 'set' from non EcmaScript module (only default export is available) error in ./node_modules/pinia/dist/pinia.
Read more >
Can't import the named export from non EcmaScript module
Hi My site name is stupefied-lamarr-20c8d9 On the server side of my app I have lambda functions and within those I'm using apollo-server-lambda...
Read more >
webpack/webpack - Gitter
Can't import the named export 'a' from non EcmaScript module (only default export is available) ERROR in ./node_modules/@ionic/core/dist/esm/loader.mjs 7:4- ...
Read more >
webpack from non ecmascript module (only default export is ...
Can't import the named export 'AggregateError' from non EcmaScript module (only default export is available) After researching, I've found out that this is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found