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.

Weird warnings with v1.0.0 and Webpack 5

See original GitHub issue
  • Operating System: Windows 10
  • Node Version: 14.9.0
  • NPM Version: 6.14.8
  • webpack Version: any above 5.0.0
  • mini-css-extract-plugin Version: 1.0.0

Expected Behavior

Clean build, without warnings, which happens with version 0.12.0, but doesn’t happen with 1.0.0

Actual Behavior

While 0.12.0 builds ok, verision 1.0.0 (without touching anything else in the setup) rises the following warning :

export 'default' (reexported as 'default') was not found in '-!../../node_modules/mini-css-extract-plugin/dist/loader.js!../../node_modules/css-loader/dist/cjs.js!../../node_module s/vue-loader/dist/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-3.use[2]!../../node_modules/sass-loader/dist/cjs.js!../../node_modules/vue-loader/ dist/index.js??ruleSet[1].rules[10].use[0]!./HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=scss' (possible exports: )

webpack.config.js


module.exports = (env, argv) => {
	const production = argv && argv.mode && argv.mode !== "development";

	const {VueLoaderPlugin} = require("vue-loader");
	const htmlWebpackPlugin = require("html-webpack-plugin");
	const MiniCssExtractPlugin = require("mini-css-extract-plugin");
	const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
	const {CleanWebpackPlugin} = require("clean-webpack-plugin");
	const autoprefixer = require("autoprefixer");
	const TerserPlugin = require("terser-webpack-plugin");
	const webpack = require('webpack');
	const path = require("path");

	const postcssOpts = {
		postcssOptions: {
			plugins: [
				autoprefixer
			]
		}
	};

	return {
		entry:        path.resolve(__dirname, 'src/main.js'),
		output:       {
			filename: 'js/[name].js',
			path:     path.resolve(__dirname, 'dist/'),
			publicPath: '/'
		},
		resolve:      {
			alias: {
				'@': path.resolve(__dirname, 'src')
			}
		},
		module:       {
			rules: [
				{
					test:    /\.js$/,
					exclude: /node_modules/,
					use:     {
						loader:  "babel-loader",
						options: {
							presets: [['@babel/preset-env']],
							plugins: ['@babel/plugin-transform-destructuring', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-template-literals'],
							babelrc: false
						}
					}
				},
				{
					test:   /\.vue$/,
					loader: "vue-loader"
				}, {
					test: /\.css$/,
					use:  [
						{loader: MiniCssExtractPlugin.loader},
						{loader: 'css-loader'},
						{
							loader:  "postcss-loader",
							options: postcssOpts
						}
					]
				}, {
					test: /\.scss$/,
					use:  [
						{loader: MiniCssExtractPlugin.loader},
						{loader: 'css-loader'},
						{
							loader:  "postcss-loader",
							options: postcssOpts
						},
						{loader: 'sass-loader'}
					]
				}, {
					test: /\.html$/,
					use:  [
						{
							loader:  'html-loader',
							options: {minimize: true}
						}
					]
				}, {
					test:    /\.(eot|ttf|woff|woff2)(\?\S*)?$/,
					loader:  "file-loader",
					options: {
						context:    'src/assets/fonts',
						name:       "[path][name].[ext]",
						outputPath: "fonts"
					}
				}, {
					test:    /\.(png|jpe?g|gif|webm|mp4|svg)$/,
					loader:  "file-loader",
					options: {
						context:    'src/assets/img',
						name:       "[path][name].[ext]",
						outputPath: "img"
					}
				}
			]
		},
		plugins:      [
			new VueLoaderPlugin(),
			new CleanWebpackPlugin(),
			new webpack.DefinePlugin(
				{
					__VUE_OPTIONS_API__:   false,
					__VUE_PROD_DEVTOOLS__: false
				}
			),
			new MiniCssExtractPlugin(
				{
					filename: 'css/[name].css',
					esModule: false
				}
			),
			new OptimizeCssAssetsPlugin(),
			new htmlWebpackPlugin(
				{
					template: path.resolve(__dirname, "public", "index.html"),
					favicon:  "./public/favicon.ico"
				}
			)
		],
		optimization: {
			minimize:    production,
			minimizer:   [
				new TerserPlugin(
					{
						parallel:      true,
						terserOptions: {
							toplevel: true,
							output:   {
								beautify: false
							}
						}
					}
				)
			],
			sideEffects: true
		},

		performance: {
			hints: false
		},
		devServer:   {
			hot:  true,
			host: '127.0.0.1',
			writeToDisk: true
		}
	};
};

How Do We Reproduce?

just create Vue 3 setup and use webpack ^5.0.0 with mini-css-extract 1.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lllopocommented, Oct 17, 2020

@evilebottnawi Ok, I’ll report it. Thanks a lot.

0reactions
alexander-akaitcommented, Oct 17, 2020

@lllopo bug in VueLoaderPlugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 5 release (2020-10-10)
JSON modules now align with the proposal and emit a warning when a non-default export is used. JSON modules no longer have named...
Read more >
Upgrade to Webpack 5 failing - node.js - Stack Overflow
I am attempting upgrade to Webpack 4 to Webpack 5. However when I run npm start I get this error. Funny thing is...
Read more >
can't resolve 'fs' webpack 5 | The AI Search Engine You Control
I get an error while building the application ng build : WARNING in ./node_modules/zone.js/dist/ ...
Read more >
Error when start -> npm run watch ? - Laracasts
Hi! This error drives me crazy.... When i run -> npm run watch i get this error from terminal: Copy Code webpack-cli] Error:...
Read more >
Deploying bedrock & sage project to server using DeployHQ
[4/5] Linking dependencies... warning " > autoprefixer@10.4.0" has ... 1 yarn run v1.22.4 $ webpack --env.production --progress --config ...
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