babeljs

TypeError: __webpack_require__.i(…) is not a function

二次信任 提交于 2020-01-24 02:16:07
问题 I am getting a webpack TypeError when I am trying to simplify an import. The following code works without any issues. Here I am importing a React Higher-Order-Component (HOC) called smartForm from core/components/form/index.js . core/components/form/index.js (does a named export of smartForm ) export smartForm from './smart-form'; login-form.jsx (imports and uses smartForm ) import { smartForm } from 'core/components/form'; class LoginForm extends React.Component { ... } export default

Trying to export a class as a module ES6 babel

天大地大妈咪最大 提交于 2020-01-23 16:24:27
问题 I have an ES6 class which I am trying to export as a module, however I am getting an error SyntaxError: Unexpected reserved word Car.js class Car { constructor(make) { this.make = make; this.currentSpeed = 25; } printCurrentSpeed(){ console.log(this.make + ' is going ' + this.currentSpeed + ' mph.'); } } module.exports = Car; I am trying to use the Car module like this main.js var Car = require("./models/Car"); let must = new Car('Mustang'); console.log(must.printCurrentSpeed()); I am using

How to import CSS file on Isomorphic React - Webpack

旧时模样 提交于 2020-01-23 08:11:07
问题 I'm trying to create an isomorphic react app using express, react, and webpack. Everything works fine until I import a css file in one of my components. I understand node can not handle this import, but can someone explain how this package on github allows their components to have a css import line? https://github.com/kriasoft/react-starter-kit I would like to make my project similar to that. Do they have a line anywhere that has the server ignore that line when rendering components? This is

How to import CSS file on Isomorphic React - Webpack

不羁的心 提交于 2020-01-23 08:10:53
问题 I'm trying to create an isomorphic react app using express, react, and webpack. Everything works fine until I import a css file in one of my components. I understand node can not handle this import, but can someone explain how this package on github allows their components to have a css import line? https://github.com/kriasoft/react-starter-kit I would like to make my project similar to that. Do they have a line anywhere that has the server ignore that line when rendering components? This is

Linting not working when using babel-eslint on Sublime Text 3

走远了吗. 提交于 2020-01-22 09:29:47
问题 I am trying to get babel-eslint to work on Sublime 3. I have installed: eslint and babel-eslint globally on npm SublimeLinter package on Sublime SublimeLinter-contrib-eslint package on Sublime Also, I have added: "syntax_map": { ... "JavaScript (Babel)": "javascript" } to my SublimeLinter.sublime-settings file. When I run the linter with "parser": "espree" on my .eslintrc file it works fine. But when I change the parser to babel-eslint it stops working. I tried to follow the tutorial here:

webpack is not finding my imports or converting my es6 code

南笙酒味 提交于 2020-01-17 03:06:05
问题 I'm new to webpack and trying to set up for my client side project. I have created a repo over here, which has my entire source code. My webpack config looks like this: var path = require('path'); module.exports = { entry: './public/js/main.js', output: { path: __dirname, filename: './public/dist/bundle.js' }, module: { loaders: [{ test: /\.js$/, loader: "babel-loader", include: [ path.resolve(__dirname, "./public/js"), ], exclude: [ path.resolve(__dirname, "node_modules"), ] }], resolve: {

Webpack error ERROR in bundle.js from UglifyJs SyntaxError: Unexpected token: name (prop) [./~/connect-mongo/src/index.js:10,0]

跟風遠走 提交于 2020-01-15 10:08:02
问题 I'm trying to prepare my Express/ReactJS app for production with webpack, and when running NODE_ENV=production webpack -p --config webpack.production.config.js I get error: ERROR in bundle.js from UglifyJs SyntaxError: Unexpected token: name (prop) [./~/connect-mongo/src/index.js:10,0] Here's my webpack.production.config file: var path = require('path'); var config = { entry: path.resolve(__dirname, './server.js'), output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' },

Webpack error ERROR in bundle.js from UglifyJs SyntaxError: Unexpected token: name (prop) [./~/connect-mongo/src/index.js:10,0]

假如想象 提交于 2020-01-15 10:06:51
问题 I'm trying to prepare my Express/ReactJS app for production with webpack, and when running NODE_ENV=production webpack -p --config webpack.production.config.js I get error: ERROR in bundle.js from UglifyJs SyntaxError: Unexpected token: name (prop) [./~/connect-mongo/src/index.js:10,0] Here's my webpack.production.config file: var path = require('path'); var config = { entry: path.resolve(__dirname, './server.js'), output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' },

Unexplained syntax error [duplicate]

安稳与你 提交于 2020-01-15 01:47:45
问题 This question already has answers here : How to use arrow functions (public class fields) as class methods? (4 answers) Closed 2 years ago . I am running into a syntax error that I simply cannot explain. Code: import React, { Component } from 'react'; class Button extends Component{ handleClick = () => { this.props.onClickFunction(this.props.incrementValue) } render() { return ( <button onClick={this.handleClick}> +{this.props.incrementValue} </button> ); } } Error Message - Unexpected token

object spread operator detected as an error on webpack for node 8.6

こ雲淡風輕ζ 提交于 2020-01-14 09:38:11
问题 I'm trying to upgrade my application's node version from node6 to node8.6 which supports spread operator natively, all works fine until I try to compile my node script using webpack. I've created a test script (testing native support for async/await too, for the occasion): const fs = require('fs') const {promisify} = require('util') const app = async () => { try { const todosString = await promisify(fs.readFile)('todos.txt', { encoding: 'utf8', }) return todosString .split('\n') .filter