dzonatan / base-href-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWWebpack plugin for inserting base href tag in head block
License: MIT License
Webpack plugin for inserting base href tag in head block
License: MIT License
Error message: Cannot read property 'tapAsync' of undefined
Also see jantimon/html-webpack-plugin#1377
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.
On nodejs
version 4.7.2
the [email protected]
release throw this error:
/var/www/node_modules/base-href-webpack-plugin/index.js:1
(function (exports, require, module, __filename, __dirname) { export class BaseHrefWebpackPlugin {
^^^^^^
SyntaxError: Unexpected reserved word
My webpack.config.json and package.json look like this. Why is nothing happening?
I'm running the website with npm run dev
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
})
])
}
{
"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"
}
}
https://github.com/jantimon/html-webpack-plugin#base-tag
I think we shouldn't support this library for html-webpack-plugin@4 and html-webpack-plugin@5 anymore
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
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",
peer dep missing: html-webpack-plugin@^4.0.0, required by [email protected]
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.