webpack-2

Webpack 2: How to exclude all node_modules except for

时光怂恿深爱的人放手 提交于 2019-12-23 10:12:12
问题 I need to have babel run on /node_modules/identicons/ However I still want to exclude all other packages. Reason is the identicons package is using template strings and breaks when I run "webpack -p" String in question (node_modules/identicons/index.js): str += `<rect x="${x}" y="${y}" width="${xside}" height="${xside}" style="fill:${color}" />` Webpack.config.babel module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, //include: /node_modules/identicons/, use: ["babel-loader"] },

Angular 2+: IE 11 Unable to get property 'call' of undefined or null reference

我们两清 提交于 2019-12-23 06:57:16
问题 I'm having an issue with Internet Explorer choking on something with Webpack. I'm using Angular-CLI 1.7.4, and Angular 5.2.10, the current versions. I'm getting this error: SCRIPT:5007 Unable to get property 'call' of undefined or null reference. Inline bundle.js (55,12) This is different than this issue, in that it is on a different line in the bundle. The line looks like this: /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); I tried modding the

Webpack with babel-loader not emitting valid es5

被刻印的时光 ゝ 提交于 2019-12-23 05:43:05
问题 I have a webpack config that is based off https://github.com/vuejs-templates/webpack-simple/blob/master/template/webpack.config.js It uses vue-loader and babel-loader. The issue is I cannot get it to generate ES5 code so that it will work in the most broad range of clients. If I use the ES2015 preset, webpack.optimize.UglifyJsPlugin fails to minify the output because Uglify can only handle ES5 (not counting the harmony branch). The errors are similar to: Unexpected token: punc (() and occur

Angular 2, @ngtools/webpack, AOT

荒凉一梦 提交于 2019-12-22 11:24:51
问题 I'm trying to use AOT in Angular 2 using webpack and @ngtools/webpack. I don't have any error with the compilation, but when I open the site on the browser I get a console error: No NgModule metadata found for 'AppModule' My AotPlugin on webpack configuration is this: new AotPlugin({ tsConfigPath: 'tsconfig.json', entryModule: helpers.root('src/app/app.module.ts#AppModule') }) My app.module.ts is: @NgModule({ bootstrap: [ App ], imports: [ // import Angular's modules BrowserModule,

Webpack-simple + vue-cli with SASS - Can't compile?

旧时模样 提交于 2019-12-22 10:29:57
问题 I set up a simple project with vue-cli and webpack-simple using the default CLI settings and made sure that 'Y' was selected when asked whether I wanted to use SASS. First, folder structure pic: I created a main.scss file in the ./src/scss directory and added the following simple scss syntax to the file: $primary-color: rgb(173, 16, 16); Then, in my App.vue template, I have it like so: <style lang="scss" scoped> h1, h2 { font-weight: normal; color: $primary-color; } </style> In my main.js

Angular 4 with Webpack 2, dynamically loading scripts

[亡魂溺海] 提交于 2019-12-22 10:27:29
问题 I am just dabbling with Angular 4 with Webpack 2 on a project. I am attempting to load some scripts during ngOnInit and am running into some problems. Problem 1.) I have the following code within my ngOnInit: System.import(`../../node_modules/jquery/dist/jquery.js`); System.import(`../../node_modules/jquery-validation/dist/jquery.validate.js`); System.import(`../../node_modules/jquery-validation/dist/additional-methods.js`); System.import(`assets/js/regular-expressions.js`); When i do this,

Using SystemJS and Webpack

不问归期 提交于 2019-12-22 07:55:08
问题 I have a solution built with Angular + Typescript + Webpack2 and I want to load dynamically some external modules that are known only at runtime. Since I can't use webpack to accomplish this task I'm exploring SystemJs. I was trying to require SystemJS but this causes the application to fail, as the execution flow hit let System = require('systemjs'); I get this error Cannot find module "." at webpackMissingModule (system.src.js:3893) [angular] at new SystemJSLoader$1 (system.src.js:3893)

import Vue from 'vue' imports “different” Vue to different files

和自甴很熟 提交于 2019-12-22 05:29:21
问题 This question is probably more about Webpack and ES6 import than about Vue. I'm writing a Vuex mutation that adds a new mykey: [] to an object in state . This needs to use Vue.set(state.myobj, 'mykey', []) , so that the new array gains reactiveness. However, when I import Vue from 'vue' to my mutations.js and use Vue.set(...) it doesn't fix the problem (it just does nothing). The problem seems to be that Vue is not the same Vue that I use in my main js file when creating the Vue object in my

how to skip typescript's noImplicitAny=true rule on node modules packages?

只愿长相守 提交于 2019-12-22 04:45:22
问题 I'm building angular 2 app using Typescript 2 and Webpack 2. As a loader I use awesome-typescript-loader. I set noImplicitAny = true in tsconfig.json. But some of npm packages I used implicitly has an 'any' type. (e.g. angular2-platform-node). So I want to skip that rule only on npm packages but not on my app source. How can I configure for that? 回答1: You can skip type checking for all declaration files with skipLibCheck compiler option (added in typescript 2.0) { "compilerOptions": {

92% chunk asset optimization - webpack

大兔子大兔子 提交于 2019-12-22 03:51:26
问题 It seems that webpack gets stuck on 92% chunk asset optimization for about 30+ seconds to show a simple js/css change. This is too long for anyone sane to sit and wait that much of their life to see something that should be rendered near instantly. We're in development mode (so we need source maps, which add to the latency) but it should still NOT be 30+ seconds. Also, we're not using uglify (which I've seen mentioned on GitHub as taking up a good amount of time). How can we get the build