webpack-2

html-webpack-plugin and webpack 2: no starting slash '/'

白昼怎懂夜的黑 提交于 2020-01-13 19:07:37
问题 I have a working webpack 1 project that I want to migrate to webpack 2 . It is almost working, my main remaining problem is with html-webpack-plugin : when I use it in webpack 2, the generated script tag is of the form: <script type="text/javascript" src="static/js/bundle.js"></script> instead of: <script type="text/javascript" src="/static/js/bundle.js"></script> Note: with the same plugin options, it works as expected in Webpack 1. Here are the relevant parts of webpack conf: entry: [ paths

webpack with bootstrap.css not work

纵然是瞬间 提交于 2020-01-11 11:53:06
问题 This is my webpack.config.js file: var ExtractTextPlugin = require('extract-text-webpack-plugin'), webpack = require('webpack'); module.exports = { entry: [ './src/app.js', ], output: { path: __dirname + '/../web/js', filename: 'build.js', }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: "url?limit=5000" } ] },

angular2 bundle node_modules only and not application code

我是研究僧i 提交于 2020-01-07 07:41:30
问题 Angular v.4 and webpack i am looking for answer of very simple question. How can i bundle node_module folder as vendor.js but not your application code. on page load seems like there are more then 300 requests from angular code to load internal files. if i am able to merge all node_modules libraries i will save lot of browser requests. I followed this example was able to get it run but it bundles libraries and your application code as well. i was able to successfully generate the vendor.js

How to use jquery from views on rails 5.1.3 + webpacker

吃可爱长大的小学妹 提交于 2020-01-07 03:39:05
问题 I want to use a simple jQuery function like so: $( document ).ready(function(){ $('body').addClass("faded"); }); From a single view in a rails 5.1.3 app, in this case 'login.html.erb' On webpack's application.js I have: var $ = require('jquery'); which makes the aforementioned jquery call work IF I put it on the same application.js file but this would mean it would be called for all the pages since <%= javascript_pack_tag 'application' %> is on the layout. When I try to run it on login.html

webpack bundle fails on reload?

被刻印的时光 ゝ 提交于 2020-01-06 05:34:16
问题 I think the problem is not with react router configuration but my index.html not being able to detect my script? This is my error: Failed to load resource: the server responded with a status of 404 (Not Found) this is my webpack config code: const compiler = webpack({ entry: ['whatwg-fetch', path.resolve(__dirname, 'js', 'index.js')], module: { loaders: [ { exclude: /node_modules/, loader: 'babel-loader', test: /\.js$/, }, { test: /\.css$/, loaders: ['style-loader', 'css-loader'] } ], },

Webpack 2 - Cannot create property 'mappings' on string

僤鯓⒐⒋嵵緔 提交于 2020-01-05 08:03:28
问题 Migrating from a working Webpack v1 config to Webpack 2. But running into an error while trying to run the build: ERROR in ./src/index.jsx Module build failed: TypeError: /home/pierce/Projects/my-js-app/src/index.jsx: Cannot create property 'mappings' on string I have updated my loaders to match the new format: module: { rules: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.(jpg|png)$/, loader: 'file-loader', query: { name: '[path][name].[hash].[ext]',

Webpack 2 - Cannot create property 'mappings' on string

空扰寡人 提交于 2020-01-05 08:03:19
问题 Migrating from a working Webpack v1 config to Webpack 2. But running into an error while trying to run the build: ERROR in ./src/index.jsx Module build failed: TypeError: /home/pierce/Projects/my-js-app/src/index.jsx: Cannot create property 'mappings' on string I have updated my loaders to match the new format: module: { rules: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.(jpg|png)$/, loader: 'file-loader', query: { name: '[path][name].[hash].[ext]',

Why does angular2-webpack-starter work with:' localhost:3000/#/', but Not with 'https://hostname/front/#/' WHY?

主宰稳场 提交于 2020-01-05 06:20:48
问题 I am using the 'angular2-webpack-stater' project and am ready to integrate with with my back end server. I setup nginx with two proxy-passes to connect to the front-end and the back-end: server { listen [::]:443 ssl; listen 443 ssl; server_name xxxxxxxxx.com; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; root /var/www; index index.php index.html index.htm; autoindex off; rewrite_log on; location ^~ /server/ { proxy_set_header X-Real-IP $remote_addr; proxy_set

Why does angular2-webpack-starter work with:' localhost:3000/#/', but Not with 'https://hostname/front/#/' WHY?

一曲冷凌霜 提交于 2020-01-05 06:20:24
问题 I am using the 'angular2-webpack-stater' project and am ready to integrate with with my back end server. I setup nginx with two proxy-passes to connect to the front-end and the back-end: server { listen [::]:443 ssl; listen 443 ssl; server_name xxxxxxxxx.com; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; root /var/www; index index.php index.html index.htm; autoindex off; rewrite_log on; location ^~ /server/ { proxy_set_header X-Real-IP $remote_addr; proxy_set

Why is Webpack ignoring my CSS files?

被刻印的时光 ゝ 提交于 2020-01-04 14:14:35
问题 I'm trying to get webpack to compile my CSS files (using PostCSS) to a separate file. From the documentation, it seems like this is exactly what ExtractTextPlugin should do. However, I cannot get webpack to do anything at all with my CSS files. The relevant project structure: dist ⎣js ⎣bundle.js public ⎣css ⎣style.css* src ⎣css ⎣index.css * file doesn’t exist (hasn’t been created) webpack.config.babel.js import webpack from 'webpack'; import path from 'path'; import ExtractTextPlugin from