Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Class constructor Smooth cannot be invoked without 'new' #93

Closed
wezzou1 opened this issue Aug 25, 2018 · 1 comment

Comments

@wezzou1
Copy link

wezzou1 commented Aug 25, 2018

Hi, nice smooth-scroll, really love it, but when I try to extends Parallax with smooth-scroll I've got this message, I don't really know why... but I think it's something with my webpack? or something,,

The error

Uncaught TypeError: Class constructor Smooth cannot be invoked without 'new'

var Parallax = function (_Smooth) {
	_inherits(Parallax, _Smooth);

	function Parallax(opt) {
		_classCallCheck(this, Parallax);

                 <!----- This line --->
		var _this = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, opt));
                 <!--- end of line --->

		_this.createExtraBound();
		_this.resizing = false;
		_this.cache = null;
		_this.dom.divs = Array.prototype.slice.call(opt.divs, 0);
		return _this;
	}
...
}

My webpack.config

'use strict';

const path = require('path');
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const SvgStore = require('webpack-svgstore-plugin');
require("babel-polyfill");

module.exports = {
	cache: false,
	context: path.resolve(__dirname, "src"),
	entry: {
		app: [
		"babel-polyfill", "./js/app.js"
		],
	},
	output: {
		filename: "[name].bundle.js",
	},
	resolve: {
		alias: {
			"TweenLite": path.resolve(__dirname, 'node_modules', 'gsap/src/uncompressed/TweenLite.js'),
			"TweenMax": path.resolve(__dirname, 'node_modules', 'gsap/src/uncompressed/TweenMax.js'),
			"TimelineLite": path.resolve(__dirname, 'node_modules', 'gsap/src/uncompressed/TimelineLite.js'),
			"TimelineMax": path.resolve(__dirname, 'node_modules', 'gsap/src/uncompressed/TimelineMax.js'),
			"ScrollMagic": path.resolve(__dirname, 'node_modules', 'scrollmagic/scrollmagic/uncompressed/ScrollMagic.js'),
			"animation.gsap": path.resolve(__dirname, 'node_modules', 'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js')
		}
	},
	module: {
		rules: [
		{
			test: /\.js$/,
			exclude: /node_modules\/(?!(dom7)\/).*/,
			use: [
			{
				loader: "babel-loader",
				options: { 
					presets: ["es2015"] 
				}
			}
			],
		},
		{
			test: /\.scss$/,
			use: [
			MiniCssExtractPlugin.loader,
			{ 
				loader: 'css-loader', 
				options: { 
					importLoaders: 1 
				}
			},
			{
				loader: 'sass-loader'
			}
			],
		},
		{
			test: /\.(png|woff|woff2|eot|ttf|svg)$/,
			loader: 'url-loader?limit=1000&name=[name]-[hash].[ext]'
		}
		],
	},
	externals: {
		'TweenMax': 'TweenMax'
	},
	plugins: [
		new MiniCssExtractPlugin({
			filename: "[name].bundle.css"
		}),
	    new SvgStore({
	      // svgo options
	      svgoOptions: {
	        plugins: [
	          { removeTitle: true }
	        ]
	      }
	    })
	],
};

How do i solve it?

@wezzou1 wezzou1 closed this as completed Aug 25, 2018
@wezzou1
Copy link
Author

wezzou1 commented Aug 25, 2018

I Solved it by install ify-loader https://github.com/browserify/ify-loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant