Giter VIP home page Giter VIP logo

base-href-webpack-plugin's People

Contributors

avaq avatar dzonatan avatar szybkisasza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

base-href-webpack-plugin's Issues

Support html-webpack-plugin 5.x

In npm8, if I depend on html-webpack-plugin 5.x, it will prompt Conflicting peer dependency, so I hope peer dependency can support 5.x
image

TypeError: baseHrefWebpackPlugin is not a constructor

Hello.
I am trying to add the plugin to react project, but face an error:

[1]         new BaseHrefWebpackPlugin({ baseHref: process.env.BASE_HREF }),
[1]         ^
[1] 
[1] TypeError: BaseHrefWebpackPlugin is not a constructor

"base-href-webpack-plugin": "^1.0.2",
"webpack": "1.12.15",

Also tried here:
https://npm.runkit.com/base-href-webpack-plugin

const baseHrefWebpackPlugin = require("base-href-webpack-plugin");

new baseHrefWebpackPlugin({ baseHref: '/' })

Screenshot:
https://www.screencast.com/t/Rctm0JPH2

What am I doing wrong?
Thank you.

Base href is not being injected into the head

My webpack.config.json and package.json look like this. Why is nothing happening?
I'm running the website with npm run dev

webpack.config.json

var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');


module.exports = {
    entry: './src/main.js',
    output: {
        path: path.resolve(__dirname, './dist'),
        publicPath: '/dist',
        filename: 'build.js',
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                    }
                    // other vue-loader options go here
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.(png|jpg|gif|svg)$/,
                loader: 'file-loader',
                   options: {
                    name: '[name].[ext]?[hash]'
                }
            }
        ]
    },
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.esm.js'
        }
    },
    devServer: {
        historyApiFallback: true,
        noInfo: true
    },
    performance: {
        hints: false
    },
    devtool: '#eval-source-map',
    plugins: [
        new HtmlWebpackPlugin(),
        new BaseHrefWebpackPlugin({ baseHref: '/test/app/' })
    ]
}

if (process.env.NODE_ENV === 'production') {
    module.exports.devtool = '#source-map'
    // http://vue-loader.vuejs.org/en/workflow/production.html
    module.exports.plugins = (module.exports.plugins || []).concat([
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: '"production"'
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            sourceMap: true,
            compress: {
                warnings: false
            }
        }),
        new webpack.LoaderOptionsPlugin({
            minimize: true
        })
    ])
}

package.json

{
  "name": "solvas-fleet",
  "description": "A Vue.js project",
  "version": "1.0.0",
  "author": "Jarre Knockaert <[email protected]>",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "vue": "^2.2.1",
    "vue-i18n": "^5.0.3",
    "vue-resource": "^1.2.1",
    "vue-router": "^2.3.0",
    "vuex": "^2.2.1"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-preset-latest": "^6.0.0",
    "babel-preset-stage-2": "^6.22.0",
    "base-href-webpack-plugin": "^1.0.2",
    "cross-env": "^3.0.0",
    "css-loader": "^0.25.0",
    "file-loader": "^0.9.0",
    "html-webpack-plugin": "^2.28.0",
    "install": "^0.8.7",
    "npm": "^4.4.4",
    "vue-loader": "^11.1.4",
    "vue-template-compiler": "^2.2.1",
    "webpack": "^2.2.0",
    "webpack-dev-server": "^2.2.0"
  }
}

Support for Webpack 4

Description
webpack-dev-server 3.0.0 / webpack 4.0 is failing to build while using this plugin.

Log

Error: Plugin could not be registered at 'html-webpack-plugin-before-html-process
ing'. Hook was not found.    
                                                
BREAKING CHANGE: There need to exist a hook at 'this.hooks'. To create a compati$
lity layer for this hook, hook into 'this._pluginCompat'.      
              
at Compilation.plugin (/home/arichardson/development/sonata-web-client/node_m
odules/webpack/node_modules/tapable/lib/Tapable.js:63:9)

at Compilation.deprecated [as plugin] (internal/util.js:53:15)

at /home/arichardson/development/sonata-web-client/node_modules/base-href-web
pack-plugin/build/index.js:28:21

Webpack 5 support

compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync('BaseHrefWebpackPlugin', (data, callback) => { TypeError: Cannot read property 'tapAsync' of undefined

Has anyone solved this issue yet?

"webpack": "^5.22.0",
"html-webpack-plugin": "^5.1.0",

New Error - compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync('BaseHrefWebpackPlugin

Hi,

Recently i started receiving the following error
compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync('BaseHrefWebpackPlugin', function (data,
callback)
TypeError: Cannot read property 'tapAsync' of undefined

I am using
"html-webpack-plugin": "4.0.0-alpha.1",
"base-href-webpack-plugin": "^2.0.0",
suddenly when i refreshed package.json started getting the above error

any help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.