webpack-2

ProvidePlugin not working with jquery - webpack

a 夏天 提交于 2019-12-10 14:54:25
问题 I am trying to access jquery in my application according to information on webpack website you are able to create global variable using webpack https://webpack.js.org/plugins/provide-plugin/ here is my webpack set up module.exports = { entry: { index: "./scripts/index.js", vendorJS: ["jquery", "jquery-validation", "jquery-validation-unobtrusive"] } , output: { path: path.join(__dirname, '/wwwroot/'), filename: '[name].js' }, resolve: { extensions: ['.js', '.jsx', '.css', '.scss', '.sass'] },

Cannot read property 'query' of undefined extract-text-webpack-plugin

只愿长相守 提交于 2019-12-10 14:12:38
问题 I'm trying to implement extract-text-webpack-plugin using webpack 2 and I'm building my webpack.config.js from scratch. When I wanted to add the plugin I followed the instructions on npm. This however gives me the following error: TypeError: Cannot read property 'query' of undefined I've looked around and didn't catch anyone else having the same problem with this plugin. I'd rather first ask if I've maybe made a mistake before assuming this is a bug. My webpack.config.js is const path =

Angular 4 - webpack: wait until bundle finished: /

Deadly 提交于 2019-12-10 13:47:02
问题 I am using Angular-Cli and I have updated all of my package.json using the ncu tool. Now when I do a npm start (webpack-dev-server --port 4200 --config config/webpack.dev.js --open --progress --profile --watch --content-base src/), webpack hangs at webpack: wait until bundle finished: / Is it possible to isolate the package causing the problem? I tried using display-error-details flag but it says it isnt recognized. I dont think it will help even if it is set. There is no error thrown, just

Webpack inject js/css file content directly to index.html

谁说我不能喝 提交于 2019-12-10 10:47:56
问题 I have code like this <html> <head> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="path_to_css/some_css.css" rel="stylesheet" type="text/css"> </head> <body> ... <script src="bootstrap/js/bootstrap.min.js"></script> <script src="jquery/jquery.min.js"></script> </body> </html> and I need plugin/loader or other way to get my html file with replaced link and script tags to content of this files, is there any way to do it? Finnaly i wrote own plugin

System.import fails at first attempt (modules[moduleId] is undefined)

好久不见. 提交于 2019-12-10 10:17:29
问题 When I use System.import() more than once in separate modules one of them doesn't work on first try (Webpack's require function returns modules[moduleId] is undefined ), but at second and at subsequent attempts it loads normally. Folder structure [webpack-test] ----[modules] --------foo.js --------bar.js --------dateHelper.js ----[node_modules] ----0.app.dist.js ----0.charts.dist.js ----1.app.dist.js ----3.app.dist.js ----app.dist.js ----app.js ----charts.dist.js ----charts.js ----index.html

Lodash not TreeShaking with Webpack with Webpack 4?

别等时光非礼了梦想. 提交于 2019-12-10 04:28:55
问题 I want to tree shake lodash as well as my unused multiply function from the generated bundle from webpack I have 2 main files app.js & math.js It contains the following code - app.js import map from "lodash/map"; import { sum } from "./math"; console.log("💩"); console.log(`2 + 3 = ${sum(2, 3)}`); map([1, 2, 3], x => { console.log(x); }); math.js export const sum = (a, b) => a + b; export const multiply = (m, n) => m * n; webpack.config.js const path = require("path"); const webpack = require(

Move from Webpack 1 to Webpack 2/3

删除回忆录丶 提交于 2019-12-09 19:01:02
问题 9 months ago I was struggling with Webpack One: [ Switching from Gulp to Webpack ] But with the recent arrival of Webpack 3, now we are willing to update our workflow. UPDATE 24.07.17 || v1 We succeed finally, it was a simple syntaxis problem: //-- webpack.config.js 'use strict'; const webpack = require('webpack'); const path = require('path'); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const extractStyles = new ExtractTextPlugin('styles.bundle.css'); const

How do I integrate the value of __webpack_nonce___ with my Content Security Policy?

与世无争的帅哥 提交于 2019-12-09 10:34:20
问题 From my understanding of Content Security Policy, the nonce has to change on every request. That means (I think) it must be generated at run-time on the client, not at build-time in the Webpack config. I've tested the webpack_nonce functionality in my app and it works great. Unfortunately, I'm not sure how to get that value, generated at run-time on the client, to the actual CSP policy, which is either set as a meta-tag in the index.html file (or some equivalent) or on the server itself. I

tslint-loader with webpack 2.1.0-beta.25

我的未来我决定 提交于 2019-12-09 08:02:34
问题 I have an angular2 Project that I compress/compile with webpack. I use tslink loader with webpack so I have tslint related configuration in webpack.config.js . module.exports = { ... tslint: { configuration: { rules: { quotemark: [true, "double"] } }, // tslint errors are displayed by default as warnings // set emitErrors to true to display them as errors emitErrors: false, // tslint does not interrupt the compilation by default // if you want any file with tslint errors to fail // set

Webpack: How can I combine two completely separate bundles using dynamic bundling

妖精的绣舞 提交于 2019-12-08 16:51:21
问题 I have spent a lot of time looking into this, but to no avail. I am aware of how code splitting and dynamic bundling works in Webpack using the import promise API. Howevr, my use case is that I have two completely separate bundles, generated separately using different webpack builds. To give you perspective, I am building React components and there is a requirement to dynamically load a react component into the page that has been compiled in a different process. Is this possible in react? I