Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Disable Strict Mode in None Module Library

I want to bundle a JavaScript project by WebPack but there is more problems in none-module libraries because imported them by 'import' capability,ECMAScript 6 module loader run strict mode by default and it tack more errors.

Question :

How can I import none module libraries without strict mode to bundle them by WebPack?

index.js
import '../examples/js/libs/draco/draco_encoder.js';
import './js/libs/codemirror/codemirror.js';
import './js/libs/codemirror/mode/javascript.js';
import './js/libs/codemirror/mode/glsl.js';
...
webpack.config.js
const path = require('path');
const webpack = require('webpack');

// webpack.config.js
module.exports = {
    entry: {
        polyfills: './editor/polyfills',
        index: './lib/index.js',
    },
    mode: 'development',
    output: {
        path: __dirname,
        publicPath: '/',
        filename: './editor/[name].bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
    devServer: {
        watchContentBase: true,
        publicPath: "/",
        contentBase: "./",
        hot: true,
        port: 8080,
    },
    module: {
        rules: [
            {
                test: /\.m?js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: ['@babel/preset-env']
                    }
                }
            }
        ]
    }
};
babel.config.json
{
    "presets": [
        "@babel/preset-env"
    ]
}

I tryed :

  1. babel
  2. esmify
  3. browserify
  4. Shimming in WebPack
  5. ... Thanks for your attention.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Webpack enables use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. About loaders: Loaders. You can easily write your own loaders using Node.js : Writing Loader. For execute JS script once in global context that can solved my problem : Script Loader

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!