Skip to content

Version 4.3.1: Missing status file generation and incomplete asset output in development mode #102

@luizzappa

Description

@luizzappa

Bug Description

In version 4.3.1 of powerbi-visuals-webpack-plugin, there are two significant issues affecting development workflow:

Issue 1: Missing Status File

  • Expected: https://localhost:8080/assets/status should return the status file
  • Actual: Returns 404 Not Found
  • Impact: Dev visual does not work

Issue 2: Incomplete Asset Generation

The webpack plugin generates fewer files compared to the CLI (pbiviz) tool:

CLI (pbiviz) generates in .tmp/drop/:

  • pbiviz.json
  • status
  • visual.css
  • visual.css.map
  • visual.js
  • visual.js.map

Webpack plugin only generates:

  • pbiviz.json

Root Cause Analysis

The issue appears to be in the afterCompilation method. After this line, should be generated the other files (status file mainly)

await this.outputFile(
path.join(options.dropPath, "pbiviz.json"),
JSON.stringify(config)
);
}

Current Workaround

// Added to webpack.config.js plugins array
{
    apply: (compiler) => {
        compiler.hooks.emit.tapAsync('StatusFilePlugin', (compilation, callback) => {
            const visualGuid = pbivizFile.visual.guid;
            const devMode = false;
            const DEBUG = '_DEBUG';
            
            const status = `${new Date().getTime()}\n${visualGuid}${devMode ? DEBUG : ''}`;
            const outputPath = path.join(__dirname, ".tmp", "drop", "status");
            
            fsExtra.outputFile(outputPath, status, { encoding: 'utf8' })
                .then(() => {
                    console.log('Status file created!');
                    callback();
                })
                .catch((err) => {
                    console.error('Error creating status file:', err);
                    callback(err);
                });
        });
    }
}

Environment

Node.js: v18.20.8
powerbi-visuals-webpack-plugin: 4.3.1
Webpack: 5.99.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions