microsoft / powerbi-visuals-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWpowerbi-visuals-webpack-plugin
License: MIT License
powerbi-visuals-webpack-plugin
License: MIT License
The current versions of ts-loader (6.1.0) and typescript (3.6.3) of the template return multiple errors (14 in total) with the newest types/node. For example:
ERROR in C:\Dev\VSCode\Power BI\circleCard\node_modules\@types\node\assert.d.ts
[tsl] ERROR in C:\Dev\VSCode\Power BI\circleCard\node_modules\@types\node\assert.d.ts(733,60)
TS1005: ';' expected.
This is a typescript problem which has been fixed in 3.8.0. Update ts-loader and typescript to the newest version to prevent this.
Operating System: macOS 10.15.7
Browser: Chrome 94.0.4606.71
Node Version: v14.15.5
powerbi-visuals-tools Version: 3.3.2
powerbi-visuals-webpack-plugin Version: 2.3.1
I am getting a following error from webpack
:
npx webpack --mode production
info Start preparing plugin template
info Finish preparing plugin template
Webpack Bundle Analyzer saved report to /Users/xxx/dev/powerbiaddin_new/ble/webpack.statistics.html
assets by status 733 bytes [cached] 1 asset
./.tmp/precompile/visualPlugin.ts 1.37 KiB [built] [code generated] [1 error]
ERROR in ./.tmp/precompile/visualPlugin.ts 3:21
Module parse failed: Unexpected token (3:21)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { Visual } from "../../src/visual";
| import powerbiVisualsApi from "powerbi-visuals-api";
> import IVisualPlugin = powerbiVisualsApi.visuals.plugins.IVisualPlugin;
| import VisualConstructorOptions = powerbiVisualsApi.extensibility.visual.VisualConstructorOptions;
| import DialogConstructorOptions = powerbiVisualsApi.extensibility.visual.DialogConstructorOptions;
webpack 5.57.0 compiled with 1 error in 203 ms
Steps to recreate
1. install latest powerbi-visuals-tools
2. create new project with pbiviz
pbiviz new ble
cd ble
3. Follow "How to build a visual with webpack" steps https://github.com/microsoft/powerbi-visuals-webpack-plugin/blob/master/README.md#how-to-build-a-visual-with-webpack
npm i webpack webpack-cli powerbi-visuals-webpack-plugin mini-css-extract-plugin webpack-bundle-analyzer extra-watch-webpack-plugin ts-loader less-loader less babel-loader json-loader base64-inline-loader @babel/preset-env @babel/core css-loader webpack-dev-server --save-dev
npm i @babel/runtime @babel/runtime-corejs3 core-js --save
npm i powerbi-visuals-api --save
4. Build with webpack
npx webpack --mode production
NOTE: I also had to correct lines 187-191 in webpack.config.js to
// visual plugin regenerates with the visual source, but it does not require relaunching dev server
new webpack.WatchIgnorePlugin({paths:[
'./.tmp/precompile/visualPlugin.ts',
"./.tmp/**/*.*"
]}),
I am not sure what may be causing ERROR in ./.tmp/precompile/visualPlugin.ts 3:21
I tried with webpack 4.46.0 as well but same error happens.
I recently updated my visual to use 3.0.0 of this package and Webpack 5. Building succeeds, and importing the visual into the browser works, but importing the visual into the desktop shows a dialog with this error: "Invalid custom visual: The file '###.pbiviz' isn't a valid custom visual."
This looks to be very similar to this issue: microsoft/PowerBI-visuals-tools#402 (It was also working in the browser, and same error message in desktop.) However, my project is using Webpack directly (this package), without the "pbiviz new" workflow. Looks like @ashfaqdawood was having the same problem (with powerbi-visuals-webpack-plugin) in that issue.
Not sure what to try next. Do you have an example that uses 3.0.0 of this package and works in desktop Power BI?
Hello,
I am trying to use VueJS + TS to build my custom Viz. I am facing errors while setting up. Since I am not that accustomed to webpack, it took me some time to solve a few of the errors that I was facing but I am unable to resolve the following error.
Following is my vue.config.js
where I am overriding the webpack.config.js.
Note: Vue CLI does not allow few props of output to be overridden directly hence need to use other prop specified by them. Also, I split rule for tsx and ts into two different rules since that's how the default webpack config for vue-cli is configured, so to avoid duplicate rules, I am specifying the same config for both rules.
const path = require('path');
const fs = require("fs");
// werbpack plugin
const webpack = require("webpack");
const PowerBICustomVisualsWebpackPlugin = require('powerbi-visuals-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const Visualizer = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
// api configuration
const powerbiApi = require("powerbi-visuals-api");
// visual configuration json path
const pbivizPath = "./pbiviz.json";
const pbivizFile = require(path.join(__dirname, pbivizPath));
// the visual capabilities content
const capabilitiesPath = "./capabilities.json";
const capabilitiesFile = require(path.join(__dirname, capabilitiesPath));
const visualSourceLocation = path.join(__dirname, "src", "visual").split('\\').join('\\\\')
// const visualSourceLocation = "../../src/visual"
// string resources
const resourcesFolder = path.join(".", "stringResources");
const pluginLocation = './.tmp/precompile/visualPlugin.ts'; // path to visual plugin file, the file generates by the plugin
const localizationFolders = fs.existsSync(resourcesFolder) && fs.readdirSync(resourcesFolder);
const certPath = path.join(__dirname, "node_modules", "powerbi-visuals-tools", "certs", "PowerBICustomVisualTest_public.pfx");
// babel options to support IE11
let babelOptions = {
"presets": [
[
require.resolve('@babel/preset-env'),
{
"targets": {
"ie": "11"
},
useBuiltIns: "entry",
corejs: 3,
modules: false
}
]
],
sourceType: "unambiguous", // tell to babel that the project can contains different module types, not only es2015 modules
cacheDirectory: path.join(".tmp", "babelCache") // path for chace files
};
module.exports = {
configureWebpack: {
entry: {
'visual.js': pluginLocation,
},
devtool: 'source-map',
mode: "development",
module: {
rules: [
{
parser: {
amd: false
}
},
{
test: /\.tsx$/,
include: /powerbi-visuals-|src|precompile\\visualPlugin.ts/,
use: [
{
loader: require.resolve('babel-loader'),
options: babelOptions
},
{
loader: require.resolve('ts-loader'),
options: {
transpileOnly: false,
experimentalWatchApi: false,
// appendTsSuffixTo: [/\.vue$/],
// happyPackMode: true
}
}
]
},
{
test: /\.ts$/,
include: /powerbi-visuals-|src|precompile\\visualPlugin.ts/,
use: [
{
loader: require.resolve('babel-loader'),
options: babelOptions
},
{
loader: require.resolve('ts-loader'),
options: {
transpileOnly: false,
experimentalWatchApi: false,
// appendTsSuffixTo: [/\.vue$/],
// happyPackMode: true
}
}
]
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.css']
},
output: {
filename: "[name]",
},
devServer: {
disableHostCheck: true,
contentBase: path.join(__dirname, ".tmp", "drop"), // path with assets for dev server, they are generated by webpack plugin
publicPath: "/assets/",
compress: true,
port: 8080, // dev server port
hot: false,
inline: false,
// cert files for dev server
https: {
// keep it commented to use webpack generated certificate
// key: path.join(__dirname, "certs","PowerBICustomVisualTest_public.key"), // for darwin, linux
// cert: path.join(__dirname, "certs", "PowerBICustomVisualTest_public.cer"), // for darwin, linux
pfx: fs.readFileSync(certPath), // for windows
passphrase: "22943715361889305"
},
headers: {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0"
},
},
externals: {
"powerbi-visuals-api": "null",
"fakeDefine": "false",
"corePowerbiObject": "Function('return this.powerbi')()",
"realWindow": "Function('return this')()"
},
plugins: [
// new MiniCssExtractPlugin({
// filename: "visual.css",
// chunkFilename: "[id].css"
// }),
// visual plugin regenerates with the visual source, but it does not require relaunching dev server
new webpack.WatchIgnorePlugin([
path.join(__dirname, pluginLocation),
"./.tmp/**/*.*"
]),
// custom visuals plugin instance with options
new PowerBICustomVisualsWebpackPlugin({
...pbivizFile,
capabilities: capabilitiesFile,
stringResources: localizationFolders && localizationFolders.map(localization => path.join(
resourcesFolder,
localization,
"resources.resjson"
)),
apiVersion: powerbiApi.version,
capabilitiesSchema: powerbiApi.schemas.capabilities,
pbivizSchema: powerbiApi.schemas.pbiviz,
stringResourcesSchema: powerbiApi.schemas.stringResources,
dependenciesSchema: powerbiApi.schemas.dependencies,
devMode: false,
generatePbiviz: true,
generateResources: true,
modules: true,
visualSourceLocation: visualSourceLocation,
pluginLocation: pluginLocation,
packageOutPath: path.join(__dirname, "dist")
}),
new ExtraWatchWebpackPlugin({
files: [
pbivizPath,
capabilitiesPath
]
}),
new webpack.ProvidePlugin({
window: 'realWindow',
define: 'fakeDefine',
powerbi: 'corePowerbiObject'
})
]
},
outputDir: path.join(__dirname, "/.tmp", "drop")
};
This gives the following errors:
Error: Child compilation failed:
Module not found: Error: Can't resolve 'fakeDefine' in '.....\node_modules\lodash':
Error: Can't resolve 'fakeDefine' in '.....\node_modules\lodash'
Module not found: Error: Can't resolve 'realWindow' in '.....\node_modules\webpack\buildin':
Error: Can't resolve 'realWindow' in .....\node_modules\webpack\buildin'
Can you elaborate what exactly are the realWindow
and fakeDefine
definitions and what could be causing this?
When compiling/packaging a custom visual with the option --noImplicitAny: true
the following error are thrown:
error in .../visualPlugin.ts
[tsl] ERROR in .../visualPlugin.ts(3,22)
TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
error in .../visualPlugin.ts
[tsl] ERROR in .../visualPlugin.ts(11,14)
TS7006: Parameter 'options' implicitly has an 'any' type.
Will send a PR with a fix by declaring each variable as any
.
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
Hello,
As per the context mentioned in the below mention issue raised by me:
realWindow and fakeDefine resolve Issue
I am getting this issue along with the mentioned above:
ERROR in path_to_project\.tmp\precompile\visualPlugin.ts
./.tmp/precompile/visualPlugin.ts
[tsl] ERROR in path_to_project\.tmp\precompile\visualPlugin.ts(13,5)
TS2322: Type '(options: VisualConstructorOptions) => Visual' is not assignable to type '(options?: VisualConstructorOptions | undefined) => IVisual'.
Types of parameters 'options' and 'options' are incompatible.
Type 'VisualConstructorOptions | undefined' is not assignable to type 'VisualConstructorOptions'.
Type 'undefined' is not assignable to type 'VisualConstructorOptions'.
i 「wdm」: Failed to compile.
I am currently trying to merge the tsconfigs for both the projects. This is what I could come up with:
{
"compilerOptions": {
"target": "es6",
"module": "es6",
"strict": true,
"allowJs": false,
"declaration": true,
"emitDecoratorMetadata": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"outDir": "./.tmp/build/",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"es2015",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
],
"files": [
"./src/visual.ts"
]
}
I have made a repo for this. If you want a reference to the base default tsconfigs and package.json, find on this link:
https://github.com/dhwanils95/vue-power-bi-visual
(Commit ID for base projects: c888b8b8a8b628f1198e40a89e511219b19c3800)
(Commit ID for initial merge: f10326c07fb3cfac8c817707e97d2d6d7025892d)
Hi Guys...
I came across 3 errors while working on a tab pane rendering in custom visual.
Its entry level Vue module as below. It has 3 dynamic loading of components.
--
--- <ModalComponent v-if="ui.activeModal" @close-modal="ui.setModal(null)" />
--
-- <SidePane @collapse="ui.switchSidePane()" :is-open="ui.sidePane">
--
--
--
--
--
--
**<script setup lang="ts">
import { computed, defineAsyncComponent, defineComponent } from "vue";
import AppMap from "./components/AppMap.vue";
import SidePane from "./components/SidePane/SidePane.vue";
import buttonBar from "./components/buttonBar.vue";
import ModalComponent from "./components/ModalWindows/ModalComponent.vue";
import { useUiStore } from "./stores/ui-store";
const ui = useUiStore();
const tabs: any = {
BaseMaps: defineAsyncComponent(() => import("./components/BaseMaps.vue")),
GeoToolbox: defineAsyncComponent(() => import("./components/GeoToolbox.vue")),
DataManager: defineAsyncComponent(() => import("./components/DataManager/DataManager.vue")),
};
I got these 3 errors while clicking on each tab of tab pane.
ChunkLoadError: Loading chunk vendors-node_modules_colorbrewer_index_es_js-node_modules_css-loader_dist_cjs_js_node_modules-16d10c failed.
ChunkLoadError: Loading chunk src_components_GeoToolbox_vue failed.
ChunkLoadError: Loading chunk src_components_BaseMaps_vue failed.
These are the relevant settings in webpack.config.js
Any body know the reason why the "ChunkLoadError".
Please advise.
Thanks in advance..
What I am looking to achieve is roughly:
1.Import resources in the import statement
import earth from '../assets/earth.png'
2.Then use it in the code
let img = new Image();
img.src=earth
In this case, print value of earth is 'assets/earth.png', but my img cannot correctly read the path.
I followed the tutorial, got it working with webpack 5, but it still says "invalid certificate". What am I doing wrong?
GET https://localhost:8080/assets/status net::ERR_CERT_AUTHORITY_INVALID
devServer: {
allowedHosts: 'all',
static: path.join(__dirname, '.tmp', 'drop'), // path with assets for dev server, they are generated by webpack plugin
compress: true,
port: 8080, // dev server port
hot: false,
// cert files for dev server
https: {
pfx: fs.readFileSync(path.join(__dirname, 'node_modules/powerbi-visuals-tools/certs/PowerBICustomVisualTest_public.pfx')), // for windows
passphrase: '30815153129428663',
},
headers: {
'access-control-allow-origin': '*',
'cache-control': 'public, max-age=0',
},
},
PS C:\Dev\VSCode\Power BI\circleCard> npm run cert
> cert
> pbiviz --install-cert
info powerbi-visuals-tools version - 4.0.5
info Use '30815153129428663' passphrase to install PFX certificate.
info Certificate path: C:\Dev\VSCode\Power BI\circleCard\node_modules\powerbi-visuals-tools\certs\PowerBICustomVisualTest_public.pfx
Path file and pass phrase are correct, but I can't get a working certificate.
I have what I think is a paths issue, but I'm new to WebPack and a bit lost. I'm using this library because I'm trying to load a WebAssembly library into a visual. Compiling works, but the visual throws two "ChunkLoadError"s, for chunk 0 and chunk 1. I can direct the browser to "https://localhost:8080/assets/0" (or ...1) just fine. The request url that WebPack attempts though is "https://app.powerbi.com/13.0.11428.218/assets/0". I'm not sure how to either change the address requested, or make that address work, or even which of those to attempt.
Here's my webpack.config.js, only slightly modified from the example in the Readme:
const path = require("path");
const fs = require("fs");
// werbpack plugin
const webpack = require("webpack");
console.log(require.resolve("powerbi-visuals-webpack-plugin"));
const PowerBICustomVisualsWebpackPlugin = require("powerbi-visuals-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const Visualizer = require("webpack-visualizer-plugin");
const ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin");
// api configuration
const powerbiApi = require("powerbi-visuals-api");
// visual configuration json path
const pbivizPath = "./pbiviz.json";
const pbivizFile = require(path.join(__dirname, pbivizPath));
// the visual capabilities content
const capabilitiesPath = "./capabilities.json";
const capabilitiesFile = require(path.join(__dirname, capabilitiesPath));
const pluginLocation = "./.tmp/precompile/visualPlugin.ts"; // path to visual plugin file, the file generates by the plugin
// string resources
// Disable resources for now.
// const resourcesFolder = path.join(".", "stringResources");
// const localizationFolders = fs.readdirSync(resourcesFolder);
const localizationFolders = [];
const resourcesFolder = ".";
// babel options to support IE11
const babelOptions = {
presets: [
[
require.resolve("@babel/preset-env"),
{
targets: {
ie: "11",
},
useBuiltIns: "entry",
modules: false,
corejs: "3",
},
],
],
sourceType: "unambiguous", // tell to babel that the project can contains different module types, not only es2015 modules
cacheDirectory: path.join(".tmp", "babelCache"), // path for chace files
};
module.exports = {
entry: {
"visual.js": pluginLocation,
},
target: "web",
node: {
fs: "empty",
},
optimization: {
concatenateModules: false,
// minimize: true, // enable minimization for create *.pbiviz file less than 2 Mb, can be disabled for dev mode
},
devtool: "source-map",
mode: "development",
module: {
rules: [
{
parser: {
amd: false,
},
},
{
test: /(\.ts)x|\.ts$/,
include: /powerbi-visuals-|src|precompile\\visualPlugin.ts/,
use: [
{
loader: require.resolve("babel-loader"),
options: babelOptions,
},
{
loader: require.resolve("ts-loader"),
options: {
transpileOnly: false,
experimentalWatchApi: false,
},
},
],
},
{
test: /(\.js)x|\.js$/,
use: [
{
loader: require.resolve("babel-loader"),
options: babelOptions,
},
],
},
{
test: /\.json$/,
loader: require.resolve("json-loader"),
type: "javascript/auto",
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: require.resolve("css-loader"),
},
{
loader: require.resolve("less-loader"),
options: {
paths: [path.resolve(__dirname, "..", "node_modules")],
},
},
],
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: require.resolve("css-loader"),
},
],
},
{
test: /\.(woff|ttf|ico|woff2|jpg|jpeg|png|webp)$/i,
use: [
{
loader: "base64-inline-loader",
},
],
},
],
},
resolve: {
extensions: [".wasm", ".tsx", ".ts", ".jsx", ".js", ".css", ".3dm"],
},
output: {
path: path.join(__dirname, "/.tmp", "drop"),
publicPath: "/assets/",
filename: "[name]",
},
devServer: {
disableHostCheck: true,
contentBase: path.join(__dirname, ".tmp", "drop"), // path with assets for dev server, they are generated by webpack plugin
compress: true,
port: 8080, // dev server port
hot: false,
inline: false,
// cert files for dev server
https: {
// key: path.join(__dirname, "certs","PowerBICustomVisualTest_public.key"), // for darwin, linux
// cert: path.join(__dirname, "certs", "PowerBICustomVisualTest_public.cer"), // for darwin, linux
pfx: fs.readFileSync(path.join(__dirname, "node_modules/powerbi-visuals-tools/certs/PowerBICustomVisualTest_public.pfx")), // for windows
passphrase: "##########",
},
headers: {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0",
},
},
externals: {
"powerbi-visuals-api": "null",
fakeDefine: "false",
corePowerbiObject: "Function('return this.powerbi')()",
realWindow: "Function('return this')()",
},
plugins: [
new MiniCssExtractPlugin({
filename: "visual.css",
chunkFilename: "[id].css",
}),
new Visualizer({
filename: "webpack.statistics.dev.html",
}),
// visual plugin regenerates with the visual source, but it does not require relaunching dev server
new webpack.WatchIgnorePlugin([
path.join(__dirname, pluginLocation),
"./.tmp/**/*.*",
]),
// custom visuals plugin instance with options
new PowerBICustomVisualsWebpackPlugin({
...pbivizFile,
capabilities: capabilitiesFile,
stringResources: localizationFolders.map((localization) => path.join(
resourcesFolder,
localization,
"resources.resjson",
)),
apiVersion: powerbiApi.version,
capabilitiesSchema: powerbiApi.schemas.capabilities,
pbivizSchema: powerbiApi.schemas.pbiviz,
stringResourcesSchema: powerbiApi.schemas.stringResources,
dependenciesSchema: powerbiApi.schemas.dependencies,
devMode: true,
generatePbiviz: false,
generateResources: true,
modules: true,
visualSourceLocation: "../../src/visual",
pluginLocation,
packageOutPath: path.join(__dirname, "dist"),
}),
new ExtraWatchWebpackPlugin({
files: [
pbivizPath,
capabilitiesPath,
],
dirs: [
"assets",
],
}),
new webpack.ProvidePlugin({
window: "realWindow",
define: "fakeDefine",
powerbi: "corePowerbiObject",
}),
],
};
Following the readme on a blank powerbi visuals project, I get this error message:
[webpack-cli] Failed to load '/Users/ling/Documents/Development/dit/powerbi/[PROJECT NAME]/webpack.config.js' config
[webpack-cli] Invalid options object. Watch Ignore Plugin has been initialized using an options object that does not match the API schema.
- options[0] should be an object:
object { paths }
- options[1] should be an object:
object { paths }
[PROJECT NAME]
is a placeholder
Some of my dependencies:
"webpack": "^5.58.2",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.3.1".
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"babel-loader": "^8.2.2",
Hello everyone,
I'm currently facing a problem with this current plugin where I must chose between 2 different behaviors:
Is there a way to get the best of those two worlds ?
Thanks in advance
I just tried to get a custom visual loading by Power BI several times. The embedded JS gets loaded, but the visual class could not be found at runtime.
The Exception Message is "Cannot read property 'myVisual530397A454264B59BCC98231C7453345' of undefined".
When I compare the JS generated from the PBIVIZ tools and this webpack visual, it seems the following vital part is missing:
var powerbi;
!function (e) {
var t;
!function (t) {
var n;
!function (t) {
t.myVisual530397A454264B59BCC98231C7453345= {
name: "myVisual530397A454264B59BCC98231C7453345",
displayName: "myVisual for Power BI",
"class": "Visual",
version: "1.0.0",
apiVersion: "1.13.0",
create: function (t) {
return new e.extensibility.visual.myVisual530397A454264B59BCC98231C7453345.Visual(t)
},
custom: !0
}
}(n = t.plugins || (t.plugins = {}))
}(t = e.visuals || (e.visuals = {}))
}(powerbi || (powerbi = {}));
What am I doing wrong?
Operating System: macOS 10.15.7
Browser: Firefox 88.0.1 (64-bit)
Node Version: v12.18.1
powerbi-visuals-tools Version: 3.1.19
powerbi-visuals-webpack-plugin Version: 2.2.6
webpack-dev-server is unable to determine the correct mime type for the status file since there is no extension.
It returns the content header with no mime type: Content-Type: ; charset=UTF-8
. By default, the browser treats this as text/html
and tries to parse the content as HTML. This results in an "XML Parsing Error: syntax error" in the console.
When auto-reload is enabled the console gets filled with these errors, making it unusable for debugging/development.
I had a look at how webpack-dev-server determines the mime type and it doesn't seem possible to override it without an extension. The best option would probably be to just give the filename an extension e.g. status.txt
it would then be served as text/plain
and shouldn't trigger the XML parser error.
pbiviz --install-cert
is not a valid command. I believe the API must have changed in more recent versions.
I'm using Webpack 5 to package pbiviz file but receiving the following error:
info Start packaging...
(node:12952) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET] DeprecationWarning: Compilation.modules was changed from Array to Set (using Array method 'reduce' is deprecated)
(node:12952) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
(node:12952) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
info Package compression enabled
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at writeFile (node:fs:2168:5)
at go$writeFile (C:\{folder}\node_modules\graceful-fs\graceful-fs.js:138:14)
at Object.writeFile (C:\{folder}\node_modules\graceful-fs\graceful-fs.js:135:12)
at C:\{folder}\node_modules\powerbi-visuals-webpack-plugin\node_modules\fs-extra\lib\output\index.js:18:27
at C:\L{folder}\node_modules\powerbi-visuals-webpack-plugin\node_modules\universalify\index.js:21:54 {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v18.14.0
What I did was:
new webpack.WatchIgnorePlugin(
{paths: [
path.join(__dirname, pluginLocation),
"./.tmp/**/*.*"
]}
),
I have also tried the same process on a couple custom visuals but same error message.
Thanks for any support!!
The example config in the Readme was not working for me until I appended _DEBUG to output.library
(${pbivizFile.visual.guid}_DEBUG
). I'm not sure if this is indicative of something else I'm doing wrong, but it looks like in development mode the customVisualHost script looks for the guid with a _DEBUG suffix and so doesn't find my visual code unless I make the above change.
Hi Team !! I'm trying to use this plugin with webpack 5 but I'm getting this error when starting the webpack server.
I followed your README.md
steps and changed everything in webpack.config.js
to make it work with webpack 5.
> [email protected] start
> webpack server
(node:41412) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
<i> [webpack-dev-server] SSL certificate: Webpack-5/node_modules/.cache/webpack-dev-server/server.pem
info Start preparing plugin template
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: https://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): https://192.168.0.13:8080/
<i> [webpack-dev-server] On Your Network (IPv6): https://[fe80::1]:8080/
<i> [webpack-dev-server] Content not from webpack is served from 'Webpack-5/.tmp/drop' directory
info Finish preparing plugin template
info Start packaging...
info Package compression enabled
info Package created!
info Finish packaging
info Need additional run
/Webpack-5/node_modules/webpack/lib/NormalModule.js:1313
const size = Math.max(1, this.generator.getSize(this, type));
^
TypeError: Cannot read properties of undefined (reading 'getSize')
at NormalModule.size (Webpack-5/node_modules/webpack/lib/NormalModule.js:1313:43)
at _ (Webpack-5/node_modules/webpack/lib/stats/DefaultStatsFactoryPlugin.js:1092:18)
at Webpack-5/node_modules/webpack/lib/stats/DefaultStatsFactoryPlugin.js:2320:9
at Hook.eval [as call] (eval at create (Webpack-5/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
at Hook.CALL_DELEGATE [as _call] (Webpack-5/node_modules/tapable/lib/Hook.js:14:14)
at Webpack-5/node_modules/webpack/lib/stats/StatsFactory.js:278:7
at StatsFactory._forEachLevel (Webpack-5/node_modules/webpack/lib/stats/StatsFactory.js:101:19)
at StatsFactory._create (Webpack-5/node_modules/webpack/lib/stats/StatsFactory.js:277:9)
at StatsFactory.create (Webpack-5/node_modules/webpack/lib/stats/StatsFactory.js:138:16)
at Webpack-5/node_modules/webpack/lib/stats/StatsFactory.js:216:24
"dependencies": {
"@babel/runtime": "^7.18.3",
"@babel/runtime-corejs3": "^7.18.3",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.7",
"core-js": "^3.22.8",
"powerbi-visuals-api": "^2.6.2",
"powerbi-visuals-utils-dataviewutils": "2.0.1",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"babel-loader": "^8.2.5",
"base64-inline-loader": "^2.0.1",
"css-loader": "^6.7.1",
"extra-watch-webpack-plugin": "^1.0.3",
"json-loader": "^0.5.7",
"less": "^4.1.2",
"less-loader": "^11.0.0",
"mini-css-extract-plugin": "^2.6.0",
"powerbi-visuals-tools": "^4.0.3",
"powerbi-visuals-webpack-plugin": "^3.0.0",
"ts-loader": "^9.3.0",
"tslint": "^5.1.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.8.3",
"webpack": "^5.73.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.1"
}
Could you help us to get support for webpack 5 so we can continue building our React components for Power BI 😊
Inside a webpack configuration file:
module.exports = {
optimization: {
runtimeChunk: true
}
}
Results in the web service with the error:
Uncaught ReferenceError: require is not defined
at <anonymous>:2:409819
at <anonymous>:2:409958
at Object.injectJsCode (cvSandboxPack.html?locale=de-DE:193:84605)
at f (cvSandboxPack.html?locale=de-DE:194:6100)
at m.loadWithoutResourcePackage (cvSandboxPack.html?locale=de-DE:194:13412)
at m.executeMessage (cvSandboxPack.html?locale=de-DE:194:15640)
at m.onMessageReceived (cvSandboxPack.html?locale=de-DE:194:15343)
at cvSandboxPack.html?locale=de-DE:194:24924
at n.invokeHandler (cvSandboxPack.html?locale=de-DE:193:105656)
at n.dispatchMessage (cvSandboxPack.html?locale=de-DE:193:105511)
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.