Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142646

Trying to run a .js file but I'm receiving an error:

$
0
0

This is the error:

'node"' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.139s]

Also, this is coming from atom text editor, if that's necessary information.

Here's my code:

const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')

const isProduction = process.env.npm_lifecycle_event === 'build'

module.exports = {
  entry: './src',
  // resolve: {
  //   alias: {
  //     'src': path.join(__dirname, '/src'),
  //     'libs': path.join(__dirname, '/src/libs'),
  //   }
  // },
  devtool: !isProduction && 'source-map',
  output: {
    path: path.join(__dirname, '/dist'),
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader'
          }
        ]
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'src/index.html',
      // minify: isProduction && {
      //   collapseWhitespace: true
      // },
      minify: isProduction,
      inlineSource: isProduction && '\.(js|css)$'
    }),
    new HtmlWebpackInlineSourcePlugin(),
    new OptimizeCssAssetsPlugin({}),
    new MiniCssExtractPlugin({
      filename: '[name].css'
    }),
    new CopyWebpackPlugin([
      { from: './src/assets/**/*', to: path.join(__dirname, '/dist'), flatten: false, force: true },
    ]),
  ],
  devServer: {
    stats: 'minimal',
    overlay: true,
    contentBase: path.resolve('src/assets'),
    // contentBase: path.join(__dirname, '/src/assets'),
  }
}

Am I just missing a package for this, or is there an error in my quote, or what?


Viewing all articles
Browse latest Browse all 142646

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>