Skip to content

Commit

Permalink
5.0.2 Broken loaders in webpack (#472)
Browse files Browse the repository at this point in the history
* Updated webpack-plugin

* Updated changelog

* Fixed bug with broken imports

* Fixed rootPath for all systems

* Updated path to all loaders to support multi system

* Changed way to import loaders

* Updated pipeline

* Removed tests from release

---------

Co-authored-by: AleksSavelev <[email protected]>
  • Loading branch information
AleksSavelev and AleksSavelev authored Aug 1, 2023
1 parent c8ea5b7 commit 107eb18
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
npm i
npm run test
npm run lint
- run: zip -r lib.zip . -x '.*' 'node_modules/*'
- run: zip -r lib.zip . -x '.*' 'node_modules/*' 'src/*' 'spec/*'
- name: Upload production artifacts
run: |
gh release upload $TAG_NAME "lib.zip#build"
Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This page contains information about changes to the PowerBI Visual Tools (pbiviz).

## 5.0.2
* Implemented common solution for webpack loaders on different environments

## 5.0.1
* Fixed broken imports in webpack.config for some cases

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-tools",
"version": "5.0.1",
"version": "5.0.2",
"description": "Command line tool for creating and publishing visuals for Power BI",
"main": "./bin/pbiviz.js",
"type": "module",
Expand Down Expand Up @@ -43,7 +43,6 @@
"css-loader": "^6.8.1",
"domain-browser": "^4.22.0",
"events": "^3.3.0",
"terser-webpack-plugin": "^5.3.9",
"extra-watch-webpack-plugin": "^1.0.3",
"fs-extra": "^11.1.1",
"https-browserify": "^1.0.0",
Expand All @@ -66,9 +65,10 @@
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"string_decoder": "^1.3.0",
"terser-webpack-plugin": "^5.3.9",
"timers-browserify": "^2.0.12",
"ts-loader": "^9.4.4",
"tty-browserify": "0.0.1",
"tty-browserify": "^0.0.1",
"typescript": "^4.9.5",
"url": "^0.11.1",
"util": "^0.12.5",
Expand All @@ -78,13 +78,13 @@
"webpack-dev-server": "^4.15.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.62.0",
"eslint": "^8.45.0",
"eslint-plugin-powerbi-visuals": "^0.8.1",
"jasmine": "5.0.2",
"jasmine-spec-reporter": "7.0.0",
"semver": "7.5.4",
"tree-kill": "1.2.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"eslint-plugin-powerbi-visuals": "^0.8.1",
"webpack-cli": "^5.1.4"
},
"optionalDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/WebPackWrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { PowerBICustomVisualsWebpackPlugin } from 'powerbi-visuals-webpack-plugin';
import ConsoleWriter from './ConsoleWriter.js';
import { resolveCertificate } from "./CertificateTools.js";
import { getRootPath, readJsonFromRoot, readJsonFromVisual } from './utils.js'
import { readJsonFromRoot, readJsonFromVisual } from './utils.js'

const config = readJsonFromRoot('config.json');
const npmPackage = readJsonFromRoot('package.json');
Expand Down Expand Up @@ -230,7 +230,7 @@ export default class WebPackWrap {
test: /(\.ts)x?$/,
use: [
{
loader: path.resolve(getRootPath(), "node_modules", "ts-loader"),
loader: "ts-loader",
options: tsOptions
}
]
Expand Down
66 changes: 35 additions & 31 deletions src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const webpackConfig = {
},
{
test: /\.json$/,
loader: path.resolve(rootPath, "node_modules", "json-loader"),
loader: "json-loader",
type: "javascript/auto"
},
{
Expand All @@ -50,10 +50,10 @@ const webpackConfig = {
loader: MiniCssExtractPlugin.loader
},
{
loader: path.resolve(rootPath, "node_modules", "css-loader")
loader: "css-loader"
},
{
loader: path.resolve(rootPath, "node_modules", "less-loader"),
loader: "less-loader",
options: {
lessOptions: {
paths: [path.resolve(rootPath, 'node_modules')]
Expand All @@ -72,40 +72,44 @@ const webpackConfig = {
}
]
},
resolveLoader: {
modules: ['node_modules', path.resolve(rootPath, 'node_modules')],
},
externals: {
"powerbi-visuals-api": 'null'
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.css'],
modules: ['node_modules', path.resolve(rootPath, 'node_modules')],
fallback: {
assert: path.resolve(rootPath, "node_modules", "assert"),
buffer: path.resolve(rootPath, "node_modules", "buffer"),
console: path.resolve(rootPath, "node_modules", "console-browserify"),
constants: path.resolve(rootPath, "node_modules", "constants-browserify"),
crypto: path.resolve(rootPath, "node_modules", "crypto-browserify"),
domain: path.resolve(rootPath, "node_modules", "domain-browser"),
events: path.resolve(rootPath, "node_modules", "events"),
http: path.resolve(rootPath, "node_modules", "stream-http"),
https: path.resolve(rootPath, "node_modules", "https-browserify"),
os: path.resolve(rootPath, "node_modules", "os-browserify"),
path: path.resolve(rootPath, "node_modules", "path-browserify"),
punycode: path.resolve(rootPath, "node_modules", "punycode"),
process: path.resolve(rootPath, "node_modules", "process"),
querystring: path.resolve(rootPath, "node_modules", "querystring-es3"),
stream: path.resolve(rootPath, "node_modules", "stream-browserify"),
_stream_duplex: path.resolve(rootPath, "node_modules", "readable-stream"),
_stream_passthrough: path.resolve(rootPath, "node_modules", "readable-stream"),
_stream_readable: path.resolve(rootPath, "node_modules", "readable-stream"),
_stream_transform: path.resolve(rootPath, "node_modules", "readable-stream"),
_stream_writable: path.resolve(rootPath, "node_modules", "readable-stream"),
string_decoder: path.resolve(rootPath, "node_modules", "string_decoder"),
sys: path.resolve(rootPath, "node_modules", "util"),
timers: path.resolve(rootPath, "node_modules", "timers-browserify"),
tty: path.resolve(rootPath, "node_modules", "tty-browserify"),
url: path.resolve(rootPath, "node_modules", "url"),
util: path.resolve(rootPath, "node_modules", "util"),
vm: path.resolve(rootPath, "node_modules", "vm-browserify"),
zlib: path.resolve(rootPath, "node_modules", "browserify-zlib")
assert: "assert",
buffer: "buffer",
console: "console-browserify",
constants: "constants-browserify",
crypto: "crypto-browserify",
domain: "domain-browser",
events: "events",
http: "stream-http",
https: "https-browserify",
os: "os-browserify",
path: "path-browserify",
punycode: "punycode",
process: "process",
querystring: "querystring-es3",
stream: "stream-browserify",
_stream_duplex: "readable-stream",
_stream_passthrough: "readable-stream",
_stream_readable: "readable-stream",
_stream_transform: "readable-stream",
_stream_writable: "readable-stream",
string_decoder: "string_decoder",
sys: "util",
timers: "timers-browserify",
tty: "tty-browserify",
url: "url",
util: "util",
vm: "vm-browserify",
zlib: "browserify-zlib"
}
},
output: {
Expand Down

0 comments on commit 107eb18

Please sign in to comment.