webpack-2

how to generate js file without webpackJsonp

空扰寡人 提交于 2020-05-08 02:38:34
问题 I want webpack to process js file (minify/uglify) but not format it as a module - so it would be just raw js file containing only the initial code (minified/uglified) without any webpackJsonp. I need such a file to load it before webpack is loaded in a browser, to detect if custom font is loaded. If I use webpack module to do it then my bundle is loaded after font file is loaded. 回答1: Set your target to node in webpack.config.js (the default is web ) module.exports = { target: 'node' }; In

how to generate js file without webpackJsonp

 ̄綄美尐妖づ 提交于 2020-05-08 02:35:33
问题 I want webpack to process js file (minify/uglify) but not format it as a module - so it would be just raw js file containing only the initial code (minified/uglified) without any webpackJsonp. I need such a file to load it before webpack is loaded in a browser, to detect if custom font is loaded. If I use webpack module to do it then my bundle is loaded after font file is loaded. 回答1: Set your target to node in webpack.config.js (the default is web ) module.exports = { target: 'node' }; In

Invalid configuration object -configuration.output.path after installing sass

ぐ巨炮叔叔 提交于 2020-03-05 03:53:58
问题 I facing an issue while running webpack using the command npm run dev , after installing npm sass "node-sass": "^4.5.2", "sass-loader": "^6.0.3", "style-loader": "^0.16.1", Issue: Invalid configuration object -configuration.output.path. given my package.json and webpack.config.js. Thanks in advance could somebody let me know what we went wrong, how could we resolve this issue. Issue: webpack.config.js var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './src/app

disable vue-cli webpack encoding image base64

孤人 提交于 2020-02-17 07:58:34
问题 i just try vuejs with webpack template, then i realize every image in my page was encoded with data:image/png;base64 .. with some reason i think i don't want to use that feature i don't set .htaccess file to encode image to base64, so i think the problem is webpack, but i can't find any webpack file related to base64 image encoding i unable to figure it out how to disable it, i already try to disable some component i think related with my issue on webpack, but it doesn't help .. do i miss

How to import an external file from project root with webpack?

≡放荡痞女 提交于 2020-01-25 02:49:26
问题 I am building an npm package that will take in custom rules from the project root - similar to the way prettier looks for a .prettierrc in the project root. In my package I am using webpack to compile the build. My app uses react, which I am pulling in externally so that the package is retrieved at runtime instead of being bundled at build time. webpack.config.js module.exports = { entry: "./src/index.js", output: {...}, module: {...}, resolve: { modules: [path.resolve("./src"), path.resolve(

webpack2 vue-cli autoprefixer not work in js file when require scss file?

寵の児 提交于 2020-01-17 10:59:46
问题 I use vue-cli, which depends on webpack2. I know vue-loader can compile .vue file, it can compile scss&autoprefixer successfully in .vue file, but when I use require .scss file in a js file, autoprefixer does not work, how can i solve it? I have try this(vue-loader.conf.js) but it does not work: module.exports = { loaders: utils.cssLoaders({ sourceMap: isProduction ? config.build.productionSourceMap : config.dev.cssSourceMap, extract: isProduction }), postcss: [ require('autoprefixer')({

“Modules” is not allowed Error

淺唱寂寞╮ 提交于 2020-01-15 11:38:06
问题 Webpack 2 comes with the new resolve setting and when I try to modify the setting in config, as follows, webpackValidator throws an error saying "Modules" is not allowed" const config = webpackValidator({ context: resolve('src'), entry: './app.js', output: { filename: 'bundle.js', path: resolve('dist'), publicPath: '/dist/', pathinfo: ifNotProd(), }, devtool: ifProd('source-map', 'eval'), module: { loaders: [ { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/ } ] }, resolve: {

Webpack 2 loading, exposing, and bundling jquery and bootstrap

只谈情不闲聊 提交于 2020-01-15 06:25:40
问题 This has been asked in piecemeal but no one seems to be able to settle on an answer. I'm very simply trying to bundle jquery THEN bootstrap and have $ , JQuery and bootstrap be exposed globally. Here's my webpack.config.js var webpack = require('webpack'); module.exports = { entry: { accountdetails: './src/main/webapp/public/js/accountdetails.js', vendor_jquerybs: ['jquery', 'bootstrap'] } , module:{ loaders: [{ test: /\.jsx?$/, exclude: /node-modules/, loader: 'babel-loader' }] }, resolve: {

loading css url() files in a specific folder with webpack

痴心易碎 提交于 2020-01-14 09:05:30
问题 I'm using a node library that has a css file inside, that css file loads an image like this background-image: url("image.png"); The file "image.png" is being requested at http://localhost:9000/ (the root) is dirty to have images all over the root of the project. Also I have another problem, I don't know why the image file of the module is not being copied to the build folder automatically, only works if I copy the image file manually to the build folder. Playing with Webpack config parameters

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

我与影子孤独终老i 提交于 2020-01-13 19:08:13
问题 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