webpack-2

Loading in local fonts with webpack 2 and the vue-cli

一个人想着一个人 提交于 2019-11-30 15:15:35
问题 I'm using the vue-cli webpack template and I'm trying to load in local fonts in my project. I'm having trouble getting the path to my fonts correct. How should my path look like? I found some information about what I might be doing wrong but I couldn't figure it out: https://github.com/webpack-contrib/sass-loader#problems-with-url File structure: In my _fonts.scss: // Webfont: LatoLatin-Regular @font-face { font-family: 'LatoLatinWeb'; src: url('../assets/fonts/LatoLatin-Regular.eot'); /* IE9

Loading in local fonts with webpack 2 and the vue-cli

允我心安 提交于 2019-11-30 14:07:15
I'm using the vue-cli webpack template and I'm trying to load in local fonts in my project. I'm having trouble getting the path to my fonts correct. How should my path look like? I found some information about what I might be doing wrong but I couldn't figure it out: https://github.com/webpack-contrib/sass-loader#problems-with-url File structure: In my _fonts.scss: // Webfont: LatoLatin-Regular @font-face { font-family: 'LatoLatinWeb'; src: url('../assets/fonts/LatoLatin-Regular.eot'); /* IE9 Compat Modes */ src: url('../assets/fonts/LatoLatin-Regular.eot?#iefix') format('embedded-opentype'),

Output an ES module using webpack

て烟熏妆下的殇ゞ 提交于 2019-11-30 12:38:09
问题 With Rollup I can output an ES module by simply setting the format option to 'es' . How can I do the same with webpack? If it's not possible now, does webpack have any plans to add it? The only thing I've found in the documentation for output.libraryTarget that mentions ES modules is this: libraryTarget: "commonjs-module" - Expose it using the module.exports object ( output.library is ignored), __esModule is defined (it's threaded as ES2015 Module in interop mode) However, it's rather unclear

Using webpack 2 from gulp (webpack-stream for webpack 2)?

橙三吉。 提交于 2019-11-30 08:26:26
I am trying to update to webpack 2. I use webpack-stream to run stuff from gulp, but it appears that webpack-stream is using it's own dependency on webpack which is webpack 1. I have not been able to find any webpack-stream with webpack 2. Is there any possibility to use webpack 2 from gulp? You need to have both webpack and webpack-stream installed: npm install --save-dev webpack-stream npm install --save-dev webpack@2.1.0-beta.25 Then you can pass the webpack object as the second parameter to webpack-stream : var gulp = require('gulp'); var webpackStream = require('webpack-stream'); var

One project with multiple package.json files

与世无争的帅哥 提交于 2019-11-30 04:59:25
I'm relatively new to modern JS development and I need help or advice about this situation I'm in. Situation: We have a React-Typescript-Redux project supporting IE8 (React 0.14). Now we're upgrading to IE11 and React 16 but IE8 should be supported. Requirement: Reduce project maintenance between browser versions by using different packages and/ or config files for each build. Problem: From research I made so far it seems impossible to use different package.json files and node_modules folders inside the same project with selected tools: npm, Webpack, React, Redux, Typescript. Yarn seems to

Navigation Error in angular2

隐身守侯 提交于 2019-11-29 20:53:32
I have updated the angular packages version from 2.4.10 to 4.0.0 after updating i am getting the following errors while navigating. ERROR Error: Uncaught (in promise): Error: Found the synthetic property @transformPlaceholder. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application. Error: Found the synthetic property @transformPlaceholder. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application And i changed the webpack.common.js configuration. see the below code new webpack.ContextReplacementPlugin( // The (\\|\/)

How to determine the installed webpack version

心不动则不痛 提交于 2019-11-29 20:33:35
Especially during the transition from webpack v1 to v2, it would be important to programmatically determine what webpack version is installed, but I cannot seem to find the appropriate API. Version Installed: Using webpack CLI : (--version, -v Show version number [boolean]) webpack --version or: webpack -v Using npm list command: npm list webpack Results in name@version-range : <projectName>@<projectVersion> /path/to/project └── webpack@<version-range> Using yarn list command: yarn list webpack How to do it programmatically? Webpack 2 introduced Configuration Types . Instead of exporting a

ReferenceError: Can't find variable: Map

最后都变了- 提交于 2019-11-29 14:41:17
I'm using Angular 4, Webpack 2.4.1, Karma 1.6 and Jasmine 2.6.1 and am writing ES2015 not TypeScript I've got a tiny angular demo app and I want to add unit tests. The demo app itself itself is working and Webpack is bundling everything correctly, but when I try to run the unit tests I see some errors in the console like this: ReferenceError: Can't find variable: Map at Static/js/app.welcome.js:2569 ( app.welcome.js is the name of my component) Webpack appears to be building my test bundle properly, Karma server is starting up correctly and PhantomJS is launching correctly, but then I see

Webpack2 not understanding @import statement in my SASS files (How to compile SASS with webpack2?)

♀尐吖头ヾ 提交于 2019-11-29 10:48:41
Using Webpack 2 and sass-loader 4.11 webpack --config webpack.config.js Here is my webpack.config.js var path = require('path'); var sass = require("./sass/lifeleveler.scss"); module.exports = { entry: './dist/main.js', output: { filename: 'lifeleveler.app.js', path: path.resolve(__dirname, 'dist') }, watch: true, watchOptions: { aggregateTimeout: 300, poll: 1000, ignored: /node_modules/ }, module: { loaders: [ { test: /\.scss$/, include: [ path.resolve(__dirname, 'node_modules'), path.resolve(__dirname, './sass') ], loaders: ["style-loader", "css-loader", "sass-loader"] } ], rules: [ { test:

Webpack 2: WARNING in .png, .svg, .. DEPRECATED. Configure optipng's optimizationLevel option in it's own options. (optipng.optimizationLevel)

跟風遠走 提交于 2019-11-29 10:16:44
This WARNING is printed ~20 times when running webpack - it processes and bundles just fine, but what does it mean? How do I get rid of it? Googling around provides little to no help unfortunately. Here's my webpack config: const ExtractTextPlugin = require("extract-text-webpack-plugin"); var webpack = require("webpack"); module.exports = { entry: { dashboard: './js/main.js', vendor: ["fixed-data-table","react","react-dom","jquery", "bootstrap", "vis",], }, output: { path: "../public", filename: 'bundle.js' }, plugins: [ new webpack.optimize.CommonsChunkPlugin({name: "vendor", filename: