All Questions

51
votes
4answers
2954 views

Javascript object bracket notation ({ Navigation } =) on left side of assign

I haven't seen this syntax before and am wondering what it's all about. The brackets on the left are throwing a syntax error: "unexpected token {" var { Navigation } = require('react-router'); I'm ...
291
votes
10answers
185571 views

Managing jQuery plugin dependency in webpack

I'm using Webpack in my application, in which I create two entry points - bundle.js for all my JavaScript files/codes, and vendors.js for all libraries like jQuery and React. What do I do in order to ...
221
votes
13answers
143903 views

Passing environment-dependent variables in webpack

I'm trying to convert an angular app from gulp to webpack. in gulp I use gulp-preprocess to replace some variables in the html page (e.g. database name) depending on the NODE_ENV. What is the best way...
247
votes
11answers
105782 views

How to bundle an Angular app for production

I would like to track and update in this thread the latest best (and hopefully the simplest) method to bundle Angular (version 2, 4, ...) for production on a live web server. Please include the Angul...
214
votes
8answers
180434 views

babel-loader jsx SyntaxError: Unexpected token

I'm a beginner in React + Webpack. I found a weird error in my hello world web app. I'm using babel-loader in webpack to help me convert jsx into js, but it seems like babel can't understand jsx syn...
123
votes
9answers
115725 views

Resolving require paths with webpack

I'm still confused how to resolve module paths with webpack. Now I write: myfile = require('../../mydir/myfile.js') but I'd like to write myfile = require('mydir/myfile.js') I was thinking tha...
6
votes
2answers
5544 views

React-router with BrowserRouter / browserHistory doesn't work on Reload

I have the following webpack config file: var webpack = require('webpack'); var path = require('path'); var BUILD_DIR = path.resolve(__dirname, 'src/client/public'); var APP_DIR = path.resolve(__dir...
71
votes
6answers
39285 views

Expose jQuery to real Window object with Webpack

I wan't to expose jQuery object to the global window object that is accesible inside developer console in browser. Now in my webpack config I have following lines: plugins: [ new webp...
57
votes
4answers
14248 views

Calling webpacked code from outside (HTML script tag)

Suppose that I have class like this (written in typescript) and I bundle it with webpack into bundle.js. export class EntryPoint { static run() { ... } } In my index.html I will inc...
68
votes
3answers
112757 views

"You may need an appropriate loader to handle this file type" with Webpack and Babel

I am trying to use Webpack with Babel to compile ES6 assets, but I am getting the following error message: You may need an appropriate loader to handle this file type. | import React from 'react'; | ...

Previous Next