Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin doesn't generate js file #11

Open
Teddy95 opened this issue Sep 19, 2019 · 2 comments
Open

Plugin doesn't generate js file #11

Teddy95 opened this issue Sep 19, 2019 · 2 comments

Comments

@Teddy95
Copy link

Teddy95 commented Sep 19, 2019

Environment

  • Plugin Version: 0.5.6
  • Webpack Version: 4.40.2
  • OS Version: Windows 10 / OS X Mojave
  • Node Version: Node 10
  • NPM Version: NPM 6
  • Browser Version: Firefox 69 / IE 11 / Edge 16

Current Behavior

Plugin doesn't generate a standalone JavaScript file.

Expected Behavior

Plugin should create a standalone JavaScript file.

Detailed Description

Here is my webpack.config.js:

/**
* Autor: Andre Sieverding
* Copyright © 2019
*/

const path = require('path')
const fs = require('fs')
const webpack = require('webpack')
const nodeExternals = require('webpack-node-externals')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const ObsoleteWebpackPlugin = require('obsolete-webpack-plugin')

// Get app configurations
var config = fs.readFileSync('config.json')
config = JSON.parse(config)

// Get node environment
const { NODE_ENV } = process.env
const isDev = NODE_ENV === 'development'
const env = isDev ? 'development' : 'production'

// Define webpack rules
const markoRule = {
    test: /\.marko?$/,
    loader: '@marko/webpack/loader'
}

const styleRule = {
    test: /\.(sass|scss|css)$/,
    use: [
        'style-loader',
        'css-loader',
        'sass-loader'
    ]
}

const vectorRule = {
    test: /\.svg/,
    loader: 'svg-url-loader'
}

const imageRule = {
    test: /\.(jpg|jpeg|gif|png|ico)$/,
    use: [
        {
            loader: 'file-loader',
            options: {
                name: 'images/[name]-[hash:8].[ext]'
            }
        }
    ]
}

const fontRule = {
    test: /\.(woff|woff2|ttf|eot)$/,
    use: [
        {
            loader: 'file-loader',
            options: {
                name: 'webfonts/[name]-[hash:8].[ext]'
            }
        }
    ]
}

// Webpack config for browser
const client = {
    name: 'Client',
    mode: env,
    entry: {
        app: isDev ? [
            'webpack-hot-middleware/client?reload=true',
            './app/client.js'
        ]: ['./app/client.js']
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: config.path + '/assets/'
    },
    devServer: isDev ? {
        contentBase: path.join(__dirname, 'dist'),
        historyApiFallback: true,
        overlay: true,
        hot: true,
        stats: 'minimal',
    } : undefined,
    devtool: isDev ? 'source-map' : undefined,
    resolve: {
        extensions: ['.js', '.json', '.marko']
    },
    module: {
        rules: [markoRule, styleRule, vectorRule, imageRule, fontRule]
    },
    plugins: [
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery'
        }),
        new MiniCssExtractPlugin({
            filename: '[name].css'
        }),
        new ObsoleteWebpackPlugin({
            name: 'outdatedBrowser',
            promptOnNonTargetBrowser: true,
            template: '<div id="outdated"><h6>Dein Browser ist veraltet!</h6><p>Aktualisiere deinen Browser um diese Webanwendung zu verwenden. <a id="btnUpdateBrowser" href="http://fsg-vm-sccm/CMApplicationCatalog/#/SoftwareLibrary/AppListPageView.xaml">Browser jetzt updaten</a></p><p class="last"><a id="obsoleteClose" href="#" title="Schließen">&times;</a></p></div>'
        }),
        isDev && new webpack.HotModuleReplacementPlugin()
    ].filter(Boolean)
}

// Webpack config for server
const server = {
    name: 'Server',
    mode: env,
    target: 'node',
    externals: nodeExternals(),
    entry: {
        server: ['./app/server.js']
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist'),
    },
    resolve: {
        extensions: ['.js', '.json', '.marko']
    },
    module: {
        rules: [markoRule, vectorRule, imageRule]
    }
}

module.exports = [
    server,
    client
]
@Teddy95
Copy link
Author

Teddy95 commented Sep 19, 2019

Webpack is generating the following files:
Screenshot_1

@Yegorich555
Copy link

Looks like the package hasn't been supported anymore. We have an improved/refactored version for webpack 5: https://github.com/AndrushkevichMikita/webpack-obsolete-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants